1

How can I remove "window3" from below json object str

var json1 = {"panel0": {"window3":{"collapsed":false},"window0":{"collapsed":false}},"panel1": {"window2":{"collapsed":false},"window1":{"collapsed":false}},"floating":{},"orientation": "horizontal"};

Thank you.

Ghislain Fourny
  • 6,971
  • 1
  • 30
  • 37
user1621860
  • 41
  • 2
  • 8

1 Answers1

1

In JSONiq it would be:

delete json $json1("panel0")("window3")

(see http://www.zorba-xquery.com/html/demo#KkcoASbF2krqvFgXSwf22RLQJgo= )

Ghislain Fourny
  • 6,971
  • 1
  • 30
  • 37
  • It is not working in jquery - i tried to run your line of code but I got error - SyntaxError: missing ; before statement [Break On This Error] delete json $json1("panel0")(key) - I am using jquery, zend html – user1621860 Aug 24 '12 at 09:47
  • Ah, sorry about that, I was not aware it was about jQuery. I added the corresponding tag. – Ghislain Fourny Aug 24 '12 at 10:23
  • Hi, do you have any solution to my query? pls advice – user1621860 Aug 24 '12 at 10:29
  • Would the following answer help? Something like "delete json1.panel0.window3"? http://stackoverflow.com/questions/208105/how-to-remove-a-property-from-a-javascript-object – Ghislain Fourny Aug 24 '12 at 11:35
  • I have tried with same, but it did not work for me :( I am now trying to fix it in other way.. i did some customization in my code and trying to fix it.but yes.. thanks for your response to my query. – user1621860 Aug 24 '12 at 11:56