How to parse JSON string like this "[\"login\",{ \"key\":\"value\"}]" to strong typing variable using SimpleJson library?
Asked
Active
Viewed 7,316 times
0
-
You need a class into which you may deserialize your json. – MakePeaceGreatAgain Feb 03 '18 at 15:13
-
Use `JArray arr = JsonConvert.DeserializeObject
("[\"login\",{ \"key\":\"value\"}]" );` to deserialize it using [Newtonsoft.Json](https://www.newtonsoft.com/json/help/html/SerializingJSON.htm) – Kunal Mukherjee Feb 03 '18 at 15:16
1 Answers
0
Try the SimpleJson.TryDeserializeObject
method. An instance of an anonymous type is placed in the variable obj
, which describes the structure of the JSON object.

Community
- 1
- 1

Artem Popov
- 344
- 2
- 11
-
-
You can cast to a `JsonArray` type or use the generic version (it can throw an exception): `JsonArray array = SimpleJson.DeserializeObject
("[\"login\",{ \"key\":\"value\"}]");` – Artem Popov Feb 03 '18 at 18:06