Topic: Generate JSON from Linq
I'm trying to create JSON from an object(including an object nested within this object) using LINQ.
The basic class structure is a collection of Attributes all contain a collection of AttributeItems. From this i want to get the AttributeID (from Attributes) and AttributeItemsID/s (from AttributeItems) for each Attribute.
The code i created is:
Dim _attributes As IEnumerable = From attribute In oWebCategoryDisplay.Attributes() _
Select AttributeId = attribute.AttributeItemId, _
AttributeItems = (From items In attribute Select AttributeItem.AttributeItemId)
But i get the error:
Expression of type 'Object' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider.
If anyone could help me, that would great!! Thanks in advance!