Skip to main content

JSON

In order to import JSON (or an array of objects), simply change the data input to [{ key: value }, ... ]. Grid.js expects each column to have a unique id field which matches the keys in the data object:

Live Editor
Result
Loading...

tip

Grid.js tries to guess the id of columns by camelCasing them if column ID is not defined.

E.g. Phone Number becomes phoneNumber

Live Editor
Result
Loading...

You can also leave the columns config empty if you want Grid.js to set the column names automatically:

Live Editor
Result
Loading...

id field accepts a function as well. If you have a complex JSON object, pass a function to id and try to refine and format your data:

Live Editor
Result
Loading...