Node: ParseJSON - XmlException

Hello folks,

i want to parse a JSON-File but the given JSON-File has numbers as JSON-Keys and the Gamma-Node “ParseJSON” changes these entries without telling me. → now I can look for these changings and replace it - it doesn’t feels very handy and flexible.

Question: are there other ways? Looks like it’s an XmlException “XmlException: Name cannot begin with the ‘3’ character, hexadecimal value 0x33.” but it took me a while to understand what’s going on
Any suggestions?

Greetings CeeYaa

can you share such a .json file?

I think it’s due to the fact that XML element names need to start with an alphabetical character or an underscore.

Hey,

Yep, because the default nodes go through this XML layer in between, you get that kind of error.

Maybe you could try the solution joreg suggested here?

@CeeYaa still care to share such a json? i’d like to try something.

had to zip it - .json was not allowed to upload
workflow_api.zip (669 Bytes)

but my problem shifted a little bit - Parsing with this strange behavior is ok
and the hint from @sebescudie remembered me on his nice workshop " Working with REST APIs" so I tried with jtd-infer.exe , jtd-codegen.exe and ObjectToJson - works but not so flexible what I want →

Load a JSON → make an OBJECT out of it → back ToJSON and send the exact JSON with changed values to API ----- problem: the loaded JSON would not be always the same
but true: a Parsing vom JSON to XML with known Types and not all string would help but I know, its more complicated than it seems to be

aha so in that case, better don’t go via xml at all but manipulate the json directly, e.g. using NuGet Gallery | Newtonsoft.Json 13.0.3

1 Like