Android how to change value of a Key/Value Pair inside JSONObject

Luke Batley

Hi i want to change/alter value of a string inside a json object which inside a JSONArray and which is from a file stored in internal storage.

My initial thoughts are to convert the object to a string do a find a replace and convert back to JSONObject search the JSONArray for the JSONObject remove the old one and put the new one in. Then save the array as a .JSON File to internal storage (will this replace the file thats already there or will it create another file with the same name?).

This is my initial thoughts on how to do this but is this the correct way or is there easier more efficient way to do this?

Swayam

First, you need to retrieve the required JSON Object form the JSON Array.

You can update the key-value pair of your JSON Object directly by using

mJsonObj.put("<key>", <value>).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to get a value from keyvalue pair list?

From Dev

How to get a value from keyvalue pair list?

From Dev

JSONObject Values into another JSONObject with Key Value Pair

From Dev

Sorting list in bash by value from keyvalue pair key=value

From Dev

How to get value of jsonObject value in android?

From Dev

list of keyvalue pair into dictionary

From Dev

KeyValue Pair C#

From Dev

How to change value inside function

From Dev

In Javascript, how can I check the existence of a specific key/value pair nested inside another key/value pair?

From Dev

Android BasicNameValuePair with JSONObject as value

From Dev

How to get the position of a Key/value pair inside a hash?

From Dev

How to process every date key-value pair inside this dictionary?

From Dev

How to change JsonObject in JsonArray?

From Dev

How to change JsonObject in JsonArray?

From Dev

Not able to change Edittext value inside listview android

From Dev

Not able to change Edittext value inside listview android

From Dev

Constructing a dictionary of ID, and keyvalue pair

From Dev

Outputting a KeyValue pair as a link in AngularJS

From Dev

from linq projection into keyvalue pair

From Dev

Convert java string into keyvalue pair

From Dev

Using Zip to convert to keyvalue pair

From Dev

Change value of input pair javascript

From Dev

How to prevent value change inside $watch

From Dev

How to change the value of sum function inside the query?

From Dev

How to change step value inside the loop?

From Dev

How to change value of property inside data attribute

From Dev

How do I create a keyValue pair (display field) by combining/having two fields in CakePHP 3?

From Dev

How do you make a tuple or keyvalue pair json serialize like a dictionary in C#

From Dev

How can I manipulate the value in key-value pair inside loop in rails?

Related Related

  1. 1

    How to get a value from keyvalue pair list?

  2. 2

    How to get a value from keyvalue pair list?

  3. 3

    JSONObject Values into another JSONObject with Key Value Pair

  4. 4

    Sorting list in bash by value from keyvalue pair key=value

  5. 5

    How to get value of jsonObject value in android?

  6. 6

    list of keyvalue pair into dictionary

  7. 7

    KeyValue Pair C#

  8. 8

    How to change value inside function

  9. 9

    In Javascript, how can I check the existence of a specific key/value pair nested inside another key/value pair?

  10. 10

    Android BasicNameValuePair with JSONObject as value

  11. 11

    How to get the position of a Key/value pair inside a hash?

  12. 12

    How to process every date key-value pair inside this dictionary?

  13. 13

    How to change JsonObject in JsonArray?

  14. 14

    How to change JsonObject in JsonArray?

  15. 15

    Not able to change Edittext value inside listview android

  16. 16

    Not able to change Edittext value inside listview android

  17. 17

    Constructing a dictionary of ID, and keyvalue pair

  18. 18

    Outputting a KeyValue pair as a link in AngularJS

  19. 19

    from linq projection into keyvalue pair

  20. 20

    Convert java string into keyvalue pair

  21. 21

    Using Zip to convert to keyvalue pair

  22. 22

    Change value of input pair javascript

  23. 23

    How to prevent value change inside $watch

  24. 24

    How to change the value of sum function inside the query?

  25. 25

    How to change step value inside the loop?

  26. 26

    How to change value of property inside data attribute

  27. 27

    How do I create a keyValue pair (display field) by combining/having two fields in CakePHP 3?

  28. 28

    How do you make a tuple or keyvalue pair json serialize like a dictionary in C#

  29. 29

    How can I manipulate the value in key-value pair inside loop in rails?

HotTag

Archive