HOW THE FUCK DO I PARSE A JSON IN C# THIS IS FUCKING BULLSHIT
HOW THE FUCK DO I PARSE A JSON IN C# THIS IS FUCKING BULLSHIT
Other urls found in this thread:
pastebin.com
newtonsoft.com
json2csharp.com
twitter.com
>Be JSChad
>JSON.parse(`{"your mom": "gay"}`);
Go to Microsoft instruction pages and read it from there
Faggot OP
Read the docu.
System.Text.Json
rtfm
ye ok, because getting a 20 000 character string/stream is the way to go right?
Read the docs guys!!!!!!!!!!!!!!!!!!!!
Do you think JSON parsing is some arcane magic that somehow *doesn't* require you to load the JSON string into memory?
C# is a terrible language, you have to wrap your code in a billion exceptions and use the most obscure undocumented APIs ever
if (buffer[i] == '{') ParseObject();
else if (buffer[i] == '[') ParseArray();
20000 characters, that's whole a 40kb of memory!!!! how do i store when i the computer has only 640kb of ram
holy shit, 20000 characters? you should've said so earlier. you're gonna need a hadoop high performance cluster for that kind of big data
It isn't too hard man, you will want to use System.Text.Json for this.
I just wrote this example for you, you can get a dictionary back like this. You can also deserialize into a class or something, just depends on what you need. Let me know if you need more help though.
XML doesn't have this problem
Actually 151779 characters
I need to work eith some shitty third party api which spews a lot of garbage, and of course, i need to work with the programming language least capable of parsing a json :^)
🤣
read as stream
attribute=""
In powershell its just:
$j = (Get-Content -path "file.json" | ConvertTo-Json)
No, it's ConvertFrom-Json. How can you fail at this...
sir, you must use the newton soft newtonsoft.com
Shit man, that's like, more than 100 KB. They don't even make hard disks that big.
1. create a model from your json (json2csharp.com
2. parse the json
Root myDeserializedClass = JsonConvert.DeserializeObject(myJsonResponse);
or select it by token (which is kinda retarded)
decimal productPrice = (decimal)o.SelectToken("Manufacturers[0].Products[0].Price");
system('echo ${input} | jq')
this is one of the most basic things any modern lang can do, try searching for it