Deserialize JSON - String is not a valid number

Hi,

I’m decoding a JSON which starts like

{
“UID”: “00000000F6166DF1F6BEAB4EBFD958890F04DD290700F21BA854455E5B4E92F1E1B56B5B121200000000010C0000F21BA854455E5B4E92F1E1B56B5B121200012F29E28F0000”,

but I am receiving the error

“message”: “Deserialize JSON Array - UID: Input string ‘00000000F6166DF1F6BEAB4EBFD958890F04DD290700F21BA854455E5B4E92F1E1B56B5B121200000000010C0000F21BA854455E5B4E92F1E1B56B5B121200012F29E28F0000’ is not a valid number. Path ‘’, line 1, position 140.”,

This is baffling me, as I am inputting a string (a JObject.tostring) and outputting a JArray. The JSON is valid and the string is valid.

My workflow looks like this, with the read text file stored in the JSON_String variable and the JObject stored as JSON_Deserialised.
image

Any help appreciated! Thanks

Can you share the JSON data @SoqedHozi?

You need UID only right?

1 Like

hi @SoqedHozi

Loop this through for each item and print the json strings

Thanks
Ashwin S

Or else try this @SoqedHozi

JsonDeserialized.Root(“UID”).tostring :slight_smile:

Loop what?

I’ll give that a go. What is the purpose of root?

Root will get the element name of the root element @SoqedHozi

Extract of JSON is in my post.

Other records will be extracted to but this is the first and where the process is failing. The JSON is valid.

Hi @SoqedHozi

Check this

Thanks
Ashwin S

Post the entire JSON @SoqedHozi

Yes that’s an array, not what I have so no need to loop. But thanks.

In which circumstances woulId need to use this? I’ve never seen it before and wondering if I have to apply it across the board?

Unfortunately adding .root has not solved the problem. I have the exact same error.

Or else try looping through the deserialized json and display all the elements @SoqedHozi

First off, how? Couldn’t use a for each. Second, why?

I am using a series of deserialise json array activities so I can create the correct output jarray variables. UID is the first of these and I am receiving this error.

This is not the first time I’ve decoded a JSON, but I’ve not seen this error before and I am unclear on the issue and how to clear it.

I’m getting exact results when I tried the same way you posted in the question @SoqedHozi,

As I think, you have posted a part of JSON, i asked you to loop through each element to get their values and

image

image

The issue is with deserialise json array, after deserialising the json into a jobject. from the error I can seethat the jobject(“uid”) is working and i nthe past I’ve had to use deserialise array to then get a result I can use. Is that not the case? Can i just use JSON_Deserialised(“UID”).tostring to use it?

This is as much of the JSON as I am willing to post.

{
“UID”: “00000000F6166DF1F6BEAB4EBFD958890F04DD290700F21BA854455E5B4E92F1E1B56B5B121200000000010C0000F21BA854455E5B4E92F1E1B56B5B121200012F29E28F0000”,

“Exception”: false,
“PingPong”: false,

“Trigger_Words”: {
“DRA”: true,
“Reputation”: false,
“Urgent”: true,
“Sentiment”: “Positive”
}
}

We need to use Deserialize JSON when the JSON we have is having the parent JSON object is element
or if the parent JSON object is a array, we have to use Deserialize JSON array @SoqedHozi .

If we have array inside the JSON element, we need to loop through the elements and inside the for loop, we need to use deserialize array to get values inside the array :slight_smile:

Hope this is clear

So in my json it is an array, correct? therefore, my approach should be correct.

Sorry, your explanation of a loop is very unclear.

I’ve never had to loop a json before, just pluck out the elements as shown originally.

We don’t have an array in this JSON @SoqedHozi :slight_smile:

Forget about looping, if you want to get any element within any number of loops, we can get that using

Assume i have a element in an array and it is in the second child object of JSON , you can simply get that using

jObj.Root(“Parent element”).Element(“First child”).Element(“Second Child”).Attribute.value or
jObj.Root(“Parent element”).Element(“First child”).Element(“Second Child”).Attribute