How to avoid broken script if JSON parse object not present?
<p>I'm receiving JSON data where I'm extracting object value as follows:</p>

<pre><code>JSON.parse(Result.Data).Obj1
</code></pre>

<p>The problem arises when the script is broken because <code>Obj1</code> is not present/included within the JSON data I'm receiving.</p>

<p>I tried:</p>

<pre><code>if(typeof JSON.parse(Result.Data).Obj1 ==="undefined") { do something }
</code></pre>

<p>And also tried:</p>

<pre><code>if( typeof(JSON.parse(Result.Data).Obj1) =="undefined") { do something }
</code></pre>

<p>And still the code is broken, How to solve that?</p>

<p><strong>UPDATE:</strong></p>

<p>The reason I'm using JSON.parse is that the data is usually received with back slashes before the quotes, like that <code>{"Data":"{\"Obj1\":\"value\"}"}</code> But in another time it comes without the Obj1 key and without any back slashes and will be like that: <code>{"Data":"value"}</code></p>