I have a string and I want to get some values from it.
My strings seem like:
string1:
"{
"id": "100000280905615",
"name": "Jerard Jones",
"first_name": "Jerard",
"last_name": "Jones",
"link": "https://www.facebook.com/Jerard.Jones",
"username": "Jerard.Jones",
"gender": "female",
"locale": "en_US"
}"
string2:
"{
"id": "100000390001929",
"name": "\u05d1\u05d2\u05e8\u15dc\u25d9 \u05d1\u05e8\u05d5\u05e9",
"first_name": "\u05d4\u05d2\u05e7\u02dc\u05d9",
"last_name": "\u05d1\u05e8\u05d5\u05e9",
"link": "https://www.facebook.com/people/\u05d2\u05d1\u05e@\u05dc\u05d9-\u05d1\u05e8\u05d4\u05e9/100000390001929",
"gender": "female",
"locale": "he_IL"
}"
Unfortunately, there is a situation that a string will be by the same concept, but without some parameters:
string3:
"{
"id": "100000390001929",
"last_name": "\u05d1\u05e8\u05d5\u05e9",
"gender": "female",
"locale": "he_IL"
}"
How can I get the values of: id
, first_name
, last_name
, gender
, locale
?
Any help appreciated!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…