Skip to content
⌘ NSIS Forum Archive

Modifying a Json file using NsJson

3 posts

miraz.zaidi#

Modifying a Json file using NsJson

I am trying to modify a file abc.json on desktop to change the value of dummy node to say, 500.
{
"home": {
"abcd": {
"dummy":100
}
},
I am using nsJson plugin as following:

var DESK
function JsonDemo
strcpy $DESK "C:\Users\zaidi.miraz\Desktop"
nsJSON::Set /file $DESK\abc.json
nsJSON::Set `homepage` `abcd` `dummy` /value `500`
functionend
But this is not working as the mentioned json file still holds the value of dummy=100.

What am I doing wrong?
Pls help.
Afrow UK#
You have changed the value to 500 in memory only. To write back to the file, use nsJSON::Serialize (check the readme).

Stu