Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Have Json File like Below

{
"Login ID":
{
"in": "ಲಾಗಿನ್ ಐಡಿ"
},
"Password": {
"in": "ಪಾಸ್ವರ್ಡ್"
},
"User Name": {
"in": "ಬಳಕೆದಾರ ಹೆಸರು"
}
}


I Have to Load this Json File and when is pass "Login ID" as parameter i should get return "ಲಾಗಿನ್ ಐಡಿ" .

But here First string like ("Login ID") is not like fixed there may be many string come.

What I have tried:

I am not getting how to do

in C# or in java script any one platform it possible please help me
Posted
Updated 4-Nov-16 0:36am
Comments
F-ES Sitecore 4-Nov-16 5:51am    
Google "c# deserialize json" and you'll find examples.

1 solution

Out the box json support in .NET is a bit lacking, so people usually turn to 3rd parties (including Microsoft) to manipulate JSON. The most popular I would say is JSON.NET, and is what I use normally.

You'll find in Nuget, or can download directly.

Once you've done that, from memory you could do something like:
JObject item = JObject.Parse(<your string="">);
string login = (string)item["Login ID];

That may not be exactly right, but it gives you the gist.

Sorry, I have no clue how its done in JavaScript, but bearing in mind that's where JSON comes from, I'd expect it to be extremely simple.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900