android - Best way to remove JSON object from JSON object -



android - Best way to remove JSON object from JSON object -

assuming have jsonobject

{ "poll_answers":{ "213":{ "poll_answer_text":"black", "poll_answer_id":"213" }, "214":{ "poll_answer_text":"white", "poll_answer_id":"214" }, "218":{ "poll_answer_text":"colorful", "poll_answer_id":"218" } } }

what relevant/best way remove** jsonobject key "214" (for example) since android remove method returns value mapped key not given object excluding object want remove. solution should like:

{ "poll_answers":{ "213":{ "poll_answer_text":"black", "poll_answer_id":"213" }, "218":{ "poll_answer_text":"colorful", "poll_answer_id":"218" } } }

the remove() method want -- however, have navigate in 1 level deeper since it's contained within jsonobject:

jsonobject object = new jsonobject("your json string"); object.getjsonobject("poll_answers").remove("214");

android json jsonobject

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -