You must Sign In to post a response.
  • Category: JQuery

    Parsing json array in c#

    Hello Friends,
    I am getting following data from server. As data is coming from server in JSON format. I need to decode it in C# by storing in a string. I need to decode the same data as I am not able to manipulate it because I am getting it from server.

    {"firstName":"John", "lastName":"Doe"},
    {"firstName":"Anna", "lastName":"Smith"},
    {"firstName":"Peter", "lastName":"Jones"}

    Please let help me to decode on the same.

    Thanks in advance

  • #763620
    You can try the JSON Serialization and De-Serialization.

    If you get the json as Generic Collection, It will be easy to do all functionalities like sorting , filtering etc

    By Nathan
    Direction is important than speed

  • #763675
    Hai Navneet,
    There could be many ways, but i am providing a solution which might work:
    1. Convert the response to Json Array using JSONArray class.

    JSONArray jsonArray= new JSONArray(yourResponse);

    2. Now you can get the json object using the getJsonObject method and use the loop to extract the attributes.

    for(var i = 0; i < jsonArray.length(); i++)

    For other ways, you can try the below links:

    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

  • Sign In to post your comments