How do I replace a value of a certain property in a JSON object?

How do I replace a value of a certain property in a JSON object?

While building a pack or JSON inside a Coda doc?

JSON inside a Coda doc.

Can you link an example Doc?

Is the JSON stored as text in a column? Is it stored as an actual object with the object() formula?

It’s stored as an actual object made with object() formula. I can’t use _Merge()+" " on it because I need to use _Merge()+" " later on it, and double merge produces garbage.

Interesting. Would love to help out! Any chance you can make a copy of the doc and pair it down to just this problem?

to modify a node within the object you use the _Merge() function with a list of the objects you want to replace…

myBigObject._Merge(replacementObject) should replace the selected node with the replacement object if the key of the replacementObject matches the key of the node you want to replace

this was the original purpose of the _Merge() function i suspect.

it does a full traversal of the tree, merging nodes in the list



Max is a genius. It should work for you!

1 Like

That is awesome. I’ll see it fits into my workflow. I ended up making a separate table to manage object switching, but this might be a simpler solution.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.