0

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)

3
  • JSON "" is not null, nor is [""]; null is null. Commented Mar 25, 2013 at 7:33
  • 4
    Don't work on the String, parse the JSON into a C# object, manipulate it there, and serialize back to JSON. Commented Mar 25, 2013 at 7:34
  • can you Explain more about it Commented Mar 25, 2013 at 7:36

3 Answers 3

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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#

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.