-2

if I have a JSON object say:

var myObj = {'data' : {'key1' : 'value', 'key2': 'value'}}

can I remove {'data':} so it becomes:

{'key1' : 'value','key2': 'value'}

  • 1
    Possible duplicate of [Remove key-value pair from JSON object](http://stackoverflow.com/questions/24770887/remove-key-value-pair-from-json-object) – Moin Shirazi Jul 17 '16 at 04:46
  • @MoinShirazi I don't want to remove key-value pair i wanted to remove the first key along with those curly braces.Possibly not s duplicate . – Amarnath King Jul 18 '16 at 21:49

1 Answers1

1

Just do this:

myObj = myObj.data;

You will then have a myObj that is just this:

{'key1' : 'value', 'key2': 'value'}
jfriend00
  • 683,504
  • 96
  • 985
  • 979