user2199888
user2199888

Reputation: 231

How to remove property from json string

hi bellow is my JSON string

\"Education\":{\"EducationLevel\":[\"\"],\"WithCertification\":[\"CISCO\"]"

how can i remove this " \"EducationLevel\":[\"\"]" from my string and should get the following JSON string

\"Education\":{\"WithCertification\":[\"CISCO\"]"

and im using string filterString = JsonHelper.JsonSerializer(filters)

Upvotes: 0

Views: 2037

Answers (3)

Srikanth Venugopalan
Srikanth Venugopalan

Reputation: 9049

I think what @Thilo means is something like this -

        const string Test = "{\"Education\":{\"EducationLevel\":[\"\"],\"WithCertification\":[\"CISCO\"]}}";
        var deserializeObject = JsonConvert.DeserializeObject<dynamic>(Test);
        var other = new { Education = new { EducationLevel = deserializeObject.EducationLevel } };
        var serializeObject = JsonConvert.SerializeObject(other);
        Console.WriteLine(serializeObject);

Note - I am using JSON.Net

Upvotes: 0

शेखर
शेखर

Reputation: 17604

You can take advantage of json in asp.net.
Here is a msdn link
http://msdn.microsoft.com/en-us/library/cc197957%28v=vs.95%29.aspx

More reading
Parsing JSON data with C#

Upvotes: 0

Raed Alsaleh
Raed Alsaleh

Reputation: 1621

you can use yourString.Replace() function to remove any unwanted chars or strings

Upvotes: 1

Related Questions