1

I am calling a WCF service that is bundling the data into a List with a type String.

The data being returned from the service in json when I do a consol.log(response.d):

"ABC 100"

What I would like to do is be able to reference each value by name or index. Can I use a List object and reference the data by index/name? If so, how? If not, what are my options?

Thanks

2 Answers 2

2

Yes use a list and this can be usefullConvert objects to JSON in C# using JavaScriptSerializer

Sign up to request clarification or add additional context in comments.

1 Comment

This wound up being exactly what I needed to do. I was passing in a List<String> which didn't give me the flexibility of calling it by name or index. I had to create an object to pass in my data elements and then build the list of that object which I then serialized to JSON
0

Can you provide a bit more detail about the input data? Is it all as a single string or as a list of strings?

Either way, I am guessing what you are looking for is an OrderedDictionary

This will let you reference data both on the index and a name/hash, which I presume is the challenging part of your question, not the splitting of the JSON string into the required data structure.

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.