0

I can get two types of json at run time

1

{ "op":"put_message",
  "args":"create_time":1386590144.372,
  "user_ids":["jin.raj1381386731048.15195712",
              "shami.gulug1378102436530.59079906",
              "sweth.pilli1378100716736.58912086",
              "sai_n.gavar1378384157577.59878517"],
  "groups":[]
}

2

{
  "op":"put_message",
  "args":"create_time":1386590144.372,
  "user_ids":"jin.raj1381386731048.15195712",
  "groups":[]
}

user_ids can be List<string> or only string.. So how can i deserialize that based on user_ids using JsonConvert libray?

Erik Philips
  • 53,428
  • 11
  • 128
  • 150
user1934329
  • 529
  • 1
  • 6
  • 18
  • `http://james.newtonking.com/json` we can use it .. – Moumit Dec 13 '13 at 13:57
  • Can you change the JSON format to always return an array (potentially only holding a single element)? – knittl Dec 13 '13 at 14:02
  • 1
    As @UfukHacıoğulları said, this `"args":"create_time":1386590144.372` isn't valid JSON. Get valid JSON first. – Matt Burland Dec 13 '13 at 14:40
  • possible duplicate of [How to handle both a single item and an array for the same property using JSON.net](http://stackoverflow.com/questions/18994685/how-to-handle-both-a-single-item-and-an-array-for-the-same-property-using-json-n) – Brian Rogers Oct 27 '14 at 03:40

0 Answers0