How to split multidimensional array string

By | August 20, 2018
Questions:

How to split retrieve data from a string of an array.

The object has an array of variables which can be multi-dimensional.

Demo Input String

CONTAINER [1, "one", false, [CONTAINER [2, "two", false]], 42, true]

Expected Results

CONTAINER
1
"one"
false
[CONTAINER [2, "two", false]]
42
true

(I would then take group 5 and run it again to get the rest of the objects)

What is a good method of splitting the string to gain the data inside?

Can regex be used?


I do have the option of formatting the string differently if another layout would make it easier.

Answers:

Leave a Reply

Your email address will not be published. Required fields are marked *