0

I have found lots of online tutorials but all of them are deserializing JSON strings into objects or lists of objects.

I just have a web service which returns either 1 or 0 as JSON.

So it prints something like:

""\"0\""

Or:

""\"1\""

How can I deserialize a simple JSON like that into a string?

6
  • 1
    So you have a string input that contains "0" or "1" and you want a string result that contains "0" or "1" depending on the input? Commented Oct 4, 2010 at 21:27
  • 1
    Technically this is not valid JSON according to the RFC spec. Commented Oct 4, 2010 at 21:28
  • No I have a JSON like this: ""\"0\"" or ""\"1\"". Sorry for confusion. Commented Oct 4, 2010 at 21:29
  • @ChaosPandion So you think the web service should just return 1 or 0 as a string? Not encoded as JSON? Commented Oct 4, 2010 at 21:30
  • @Richard Knop: the web service should return a JSON Object or a JSON Array. Commented Oct 4, 2010 at 21:40

1 Answer 1

1

According to the RFC4627 a valid JSON string is defined as either a JSON object or a JSON array. Your web service should return something similar to this.

{ "Result": 0 }
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.