0

I have the next JSON

{
   "attrib1":"value1",
   "attrib2":"value2",
   "attrib3":"value3"
}

this Json are saved into a JObject, and I want to create some function that change an specific value of this Json, in this case the attrib1, just like:

JObject ChangeJson(JObject request,string new_value)
{
  //some stuff to change the value from "attrib1"="value1" to "new_value"
}

the new Json:

    {
       "attrib1":"new_value",
       "attrib2":"value2",
       "attrib3":"value3"
    }

Hope you can help me

  • 1
    Possible duplicate of [How to parse json in C#?](http://stackoverflow.com/questions/6620165/how-to-parse-json-in-c) – Scott Solmer Sep 16 '14 at 22:13

2 Answers2

0

hope this will help

request.attrib1 = "new_value";

bl2b
  • 123
  • 4
0

You don't want to tell me that you tried to find a answer yourself?

Rules:

Don't ask about...

Questions you haven't tried to find an answer for (show your work!)

Anyway...

request["attrib1"] = "new_value";

will do the Job. It will modify the request object in-place.

Suchiman
  • 1,636
  • 2
  • 20
  • 30