0

I have seen many ways to convert json array into string but none of them are working.

Can anyone help me how do I convert json array into string in wcf.

Please help me through it.

1 Answer 1

1

I using JSON.NET for serialize and deserialize objects. You can install it with nuget, http://www.nuget.org/packages/Newtonsoft.Json/

MyObject result = Newtonsoft.Json.JsonConvert.DeserializeObject<MyObject >(jsonString);

string stringResult = Newtonsoft.Json.JsonConvert.SerializeObject(myObject);
Sign up to request clarification or add additional context in comments.

2 Comments

Can u specify the code to deserialize object? @Daniel
Now instead of MyObject I have written dynamic and Suppose I got {"Tb_id":1,"detail": [{ "Item_id":"Bvrgs1" , "Quantity":1,"add_Details":"Spicy" },{ "Item_id":"Bvrgs2" , "Quantity":2,"add_Details":"Sweet" },{ "Item_id":"Bvrgs3" , "Quantity":3,"add_Details":"" }]} Now what do I do if I want Tb_id,Item_id,Quantity,Add_Details separately?

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.