Following the example provided here: http://datajs.codeplex.com/wikipage?title=Metadata%20Generation%20Sample&referringTitle=Documentation
I retrieve metadata in the form:
{"version":"1.0","dataServices":{"dataServiceVersion":"1.0","schema":[{"namespace":"IdeasDbModel","entityType":[{"name":"Category","key":{"propertyRef":[{"name":"CategoryID"}]},"property":[{"name":"CategoryID","type":"Edm.Int32","nullable":"false","extensions":[{" ...
How can I parse this in JavaScript to retrieve metadata information such as column type, primary key, etc for example table Category has primary key (propertyRef) CategoryID and that column is of type Edm.Int32? I don't understand the format of the results. Under dataServices -> Schema[0] -> entityType (or association), it is just an array of objects so do I have to loop through every single element to find a matching result or is there an easier way to have the columns keyed by name?
You should look at JayData. It creates a JavaScript class context from the metadata, that you can use more intuitively. An example after referencing JayData in your page:
The result: