question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use the nested JSON object through setting?

See original GitHub issue

Hi I have a nested JSON

[country:{
    "name":"India",
     "states":{
                   [{
                     .................
                    }]
                  }

}
...
]

I have tried but doesn’t work 😦

settings:{
        columns:{
              country:{
                    title:"Countries"
              },
              country.states:{
                     title:"States"
              }
        }
}

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:38

github_iconTop GitHub Comments

31reactions
OrenciucEvgheniicommented, Apr 26, 2017

Hi guys, I found a sollution: Use valuePrepareFunction for each element you need to prepare the value:

settings:{
        columns:{
              country:{
                    title:"Countries"
              },
              country:{
                     title:"States",
                     valuePrepareFunction: (country) => {
                         return country.state;
                     }
              }
        }
}

more on https://akveo.github.io/ng2-smart-table/#/documentation

11reactions
hamdullahcommented, Aug 18, 2017

I have fixed the issue by using (cell, row) here is code snippet: initiator: { title: “Started By”, type:‘string’, valuePrepareFunction: (cell,row) => { return row.startedBy.lastName; } }, email: { title: “Email”, type:‘string’, valuePrepareFunction: (cell,row) => { return row.startedBy.email; } }, Hope it works for you too. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON.simple - How to correctly access nested JSON objects
Yes, you are right, simply extract the JSONObject within the loop and then get the required fields. public class main { public static...
Read more >
How can we parse a nested JSON object in Java?
We can parse a nested JSON object using the getString(index) method of JSONArray. This is a convenience method for the getJSONString(index).
Read more >
Storing and retrieving Nested JSON document
Example of Nested JSON object​ · Step 1. Run RedisJSON Docker container​ · Step 2. Verify if RedisJSON module is loaded​ · Step...
Read more >
how to parse nested json in java - You.com | The AI Search ...
How to parse nested JSON in Java? A JSON Object is an unordered set of key/value pairs. · How to fetch the data...
Read more >
JSON nested objects - IBM
Objects can be nested inside other objects. Each nested object must have a unique access path. The same field name can occur in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found