September 7, 20187 yr Hi Everyone, I've got a JSON issue that I've been struggling to figure out. Here is a sample output of what I'm trying to do: { "fulfillment": { "location_id": 905684977, "tracking_numbers": [ "a4e6e7ca452c7873c2ef10234d042352", "81669206ee8e6164da5ac190af93e6ca", "3def69908a9530b5c46b282a988cf914" ], "line_items": [ { "id": 466157049 }, { "id": 518995019 }, { "id": 703073504 } ] } } It's the "tracking_numbers" that is throwing me off. I can build normal arrays like "line_items" no problem, but I've no idea how to structure the JSONSetElement function in a way that gives me multiple values for a single key as seen in "tracking_numbers". Any help would be greatly appreciated!
September 7, 20187 yr Author I figured it out. Here is the code that gets the job done. JSONSetElement ( $$json ; ["tracking_numbers[0]" ; "4324234" ; JSONString]; ["tracking_numbers[1]" ; "2342342" ; JSONString] )
September 7, 20187 yr Hello Just looking at the documentation it says :- You can set multiple elements by providing an additional set of keyOrIndexOrPath, value, and type parameters in brackets [ ] for each element. The following syntax sets N elements at once: JSONSetElement ( json ; [ keyOrIndexOrPath1 ; value1 ; type1 ] ; [ keyOrIndexOrPath2 ; value2 ; type2 ] ; ... [ keyOrIndexOrPathN ; valueN ; typeN ] ) Does that help Exactly! We over-lapped there....
September 7, 20187 yr Author 57 minutes ago, rwoods said: ..... Exactly! We over-lapped there.... Overlapped indeed! I appreciate you taking the time to answer nonetheless! Thanks!
Create an account or sign in to comment