Extract value from json string

I


t's all new to me, and the examples I've found, come close but don't help me solve. I managed to get a json string which contains a list with two values. Unfortunately I can't extract the values ​​in the form of number, but they remain in this format ["227"]. Help would be greatly appreciated. Thank you in advance

AI2 will treat it as a number if you need to use it as a number on Maths calculations etc.

If you really want it to display as a number, then again using maths blocks, simply multiply it by 1.

Unfortunately I don't know how! I'm now getting familiar with blocks and using them by looking at examples of all kinds and tutorials I've found in this wonderful forum.

image

Thanks, I assume that instead of 227 I should put the variable which is extracted from the json string. Correct?

image

If you also set the textbox to numbers only, it should only accept numbers....

Thanks, I just tested your suggestion, but we have to consider that inside the variable 'global xcolli' we have this format ["227"] and this produces an error

You are getting a list with only one item.

You need to pick item 1 from the list.

Or, do not use ' list by walking key path ', but use 'get item with key path '.

Actually I'm trying to modify the code and the blocks because the problem happens with the result of every query. I did a test with a query that returns an array of 5 fields, for example, 'name, surname, age, and date of birth, and clearly I get the values ​​inside the brackets, while I would like to hide the real data contained in each portion of the 'array

Give a real example of your data in text, and what you want to pick?

I fixed it by adopting this method which I want to show for someone else having the same problem. By iterating all the json string that returns from the Web call, I can extract all the values ​​as absolute values ​​and without parentheses and thus assign them to the relative text boxes. Thank you

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.