Discussions relating to the ScottKlement.com port of the open source YAJL JSON Reader/Generator. This includes the YAJL tool as well as the YAJLR4, YAJLGEN, YAJLINTO and YAJLDTAGEN add-ons from ScottKlement.com. http://www.scottklement.com/yajl/
I have a task where I need to read a database file that has a column that contains a JSON string. I will then execute code based on the value of a key in that string and then modify the value for that key and update the table. All that is pretty straightforward except for "modify the value for that key". I've looked through the service programs but nothing jumps out at me. Is there a procedure that would allow me to change the value for a key?
I have never come across any YAJL routines to do this.
When I needed to do the same thing a while back I used DATA-INTO with YAJLINTO to parse the JSON into a DS. Made the changes. Then used DATA-GEN with YAJLGEN to recreate the JSON.
YAJL doesn't currently have that ability. You'd need to load everything into your program, then write it back as a new document with a different value.
As Jon points out, that'd be very easy to do with DATA-INTO/DATA-GEN.