1

I want to return string values from a web method function, presently it returning JSON array value as:

{"statusCode":200,"result":{"totalCount":1,"resultCount":1,"items":[{"Category":"Content Types","Database":"master","DisplayName":"New Home","HasChildren":false,"Icon":"/temp/IconCache/Network/16x16/home.png","ID":"{7FA85E0C-5E09-4B8E-9F1C-B362D562FADD}","Language":"en","LongID":"/{11111111-1111-1111-1111-111111111111}/{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}/{8418FEEC-DC96-42C5-AC38-AD3942497A18}/{7FA85E0C-5E09-4B8E-9F1C-B362D562FADD}","MediaUrl":"/~/icon/Network/48x48/home.png.aspx","Name":"New Home","Path":"/sitecore/content/Content Types/New Home","Template":"User Defined/test /Content Types/Home","TemplateId":"{8112E624-DAD0-429C-A185-BE4A82A2D648}","TemplateName":"Home","Url":"~/link.aspx?_id=7FA85E0C5E094B8E9F1CB362D562FADD\u0026amp;_z=z","Version":1,"Fields":{}}]}} 

i'm trying something like this to convert it to string :

System.Web.Script.Serialization.JavaScriptSerializer js = new     System.Web.Script.Serialization.JavaScriptSerializer();
        var table = js.DeserializeObject<string>(jsonArray);

can some one help me how to make it happen.

1
  • iterate through them and concate the values in a new string. tempVar += value; Commented Feb 5, 2015 at 14:25

1 Answer 1

2

you can try like this:

      var strOuptut = readStream.ReadToEnd();
       Newtonsoft.Json.Linq.JObject obj = Newtonsoft.Json.Linq.JObject.Parse(strOuptut);
       StringBuilder html = new StringBuilder();
Sign up to request clarification or add additional context in comments.

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.