Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.ArgumentException: 'Can not add Newtonsoft.Json.Linq.JObject to Newtonsoft.Json.Linq.JObject.' #2386

Open
robeverett opened this issue May 1, 2022 · 0 comments

Comments

@robeverett
Copy link

This is my C# JSON code:

Object rss =
new JObject(
new JProperty("Products",
new JObject(
from c in Categories
select new JObject(
new JProperty("ProductCategoryID", c.CategoryID),
new JProperty("Category", c.Name),
new JProperty("psc",
new JArray(
from sc in Subcategories
where sc.CategoryID == c.CategoryID
select new JObject(
new JProperty("ProductSubcategoryID", sc.SubcategoryID),
new JProperty("SubCategory", sc.Name),
new JProperty("p",
new JArray(
from p in Products
where p.scID == sc.SubcategoryID
select new JObject(
new JProperty("Item", p.Name),
new JProperty("ProductID", p.ProductID),
new JProperty("ListPrice", p.ListPrice)))))))))));

        Console.WriteLine(rss.ToString());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant