Question Response with nest

AussieBoy

Well-known member
Joined
Sep 7, 2020
Messages
78
Programming Experience
Beginner
Hi, I am new to Json.
I have been managing with Json up to now.
However, I have an example, which has a nest with in it.
I have been using something like
C#:
Values[1] = Root.workData.calculatedFlag.ToString();
How do I deal with this?
I guess we have to iterate through the custom attributes / attributes some how.
Thanks,
JSON:
{
  "status": true,
  "workData": {
    "calculatedFlag": false,
    "noOfTasks": "4",
    "customAttributes": {
      "Attribute": [
        {
          "name": "LocationDescription",
          "value": "Street 1",
          "properties": ""
        },
        {
          "name": "StatusDescription",
          "value": "IN SERVICE",
          "properties": ""
        },
        {
          "name": "TypeDescription",
          "value": "Respond",
          "properties": ""
        }
      ]
    },
    "Value": "0.00",
    "Cost": "0.00"
  }
}
 
Last edited by a moderator:
How do you currently deal with arrays and lists in your non-JSON related C# code? You would do the same thing.
 
I am wondering why you think you need to iterate anything.

Can you explain what you are doing or aiming to do, and what are you using to read/write your json data?
 
Yes, sorry I found it difficult to ask my question.
So, initially I was writing the main payload to a table.
When I had chance to come back to it, I have written the attributes (nested part) to another table.
So I can display the data. (display data from the two tables).
Is this the best way to do it. Only the attributes can vary in size. 2 to 6.

I suppose I could add more rows with the same workData number to the same table with different attribute data in each row.

Is there a common practice?

Thanks,
 
What do you hope to gain with the dynamic object? Just hoping to have less typing by not having to define the various classes?

What's wrong with just using JSON.NET's LINQ to JSON?
 
Back
Top Bottom