I have the following array that is returned by an Oraclize query as a string.

[1, [2, 3, 4, 5]]

I need to parse the numbers 2, 3, 4, 5 from the internal array as Integers, but having troubles with the Solidity code. So far, I managed to parse only the first number by using the .toSlice() method of the strings Solidity library:

uint256 firstParsedNumber = parseInt(arraySlice.beyond("[".toSlice()).until("]".toSlice()).toString());

this returns the needed 2.

What would be the best way to parse those integers out of the stringified inner array?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.