JSON containers

I have a data set which is the following format:
[
{“version_id”:“1660”},
{“version_id”:“1639”}
]

and I would like to put the data into the following format;

[
{“CurrentValues”:
{“version_id”:“1660”},
{“version_id”:“1639”}
}
]

Any help would be much appreciated.

Hi @peter,

Your second json structure is not a valid one.

/Igor

1 Like

Hi @peter,

When you post JSON or code snippets, please put them inside a “Preformatted text” section, otherwise, the double-quotes will get mangled by the forum into left-right quotes, which won’t be usable as JSON.

Your example is a bit ambiguous. Is the first “data set” a single input document containing an array, or is it two separate input documents, each containing a separate object? I’ll assume the first for now.

Also, Igor is correct, the second JSON block isn’t valid JSON syntax. I’ll assume you intend for the value of “Current Values” to be the array of objects from the input document.

If those assumptions are correct, try this: