#JSON editor, manipulator?

1 messages · Page 1 of 1 (latest)

unreal tangle
#

Looking to find the best way to edit lastpath JSON objects.
JSON 1 - [{"x":10,"y":10},{"x":10,"y":20},{"x":10,"y":30},{"x":10,"y":40},{"x":10,"y":50},{"x":10,"y":60},{"x":10,"y":70}]
JSON 2[{"x":0,"y":0},{"x":0,"y":20},{"x":0,"y":30},{"x":0,"y":40},{"x":0,"y":50},{"x":0,"y":60},{"x":0,"y":70}]

I'm looking to remove the last entry from JSON 1, take the first entry from JSON 2, and merge them so in this example the output would be this:
[{"x":0,"y":0},{"x":10,"y":10},{"x":10,"y":20},{"x":10,"y":30},{"x":10,"y":40},{"x":10,"y":50},{"x":10,"y":60}]

This is the most simple example however I'd like to know if there are shift tricks or other techniques to quickly shift JSON around. Another example would be if I want to trim the last 5 off JSON 1 and take the first 5 from JSON 2 and then merge these two JSON together, making sure the json.length doesn't change once outputted.

shell hinge
#

So json.append( json.remove(json2, json.length(json2)-1), json.get(json1, 0))
There are many json functions so you will have to explore. If you want to do tricks like shifting, popping, splitting, you might have to roll your own functions or go to JS