E
E
Egor Ogurtsov2016-04-05 09:39:41
JavaScript
Egor Ogurtsov, 2016-04-05 09:39:41

Is it possible to place different objects in one json?

There are objects like this

{
  "Id":1,
  "Name":"Some name",
  "Thumb":"images/thumb-01.png",
  "Image":"images/full-01.png",
  "Length":14.00,
  "Width":4.70,
  "Comment":"Some text", 
  "PriceBasic":1860000
}

and dependent on them (may be with a different structure)
{
  "Id":1,
  "Parent": 1,
  "GroupId":"Group ID",
  "GroupName":"Group name",
  "Name":"Some name",
  "Thumb":"images/elements/thumb-01.png",
  "Image":"images/elements/full-01.png",
  "PriceType":"fixed",
  "Percent": 0,
  "Comment":"Some text", 
  "PriceBasic":15000
}

Is it possible to put all this in one json?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2016-04-05
Khatter @mrKhatter

Why not? Make a multidimensional array and you will be happy!

I
iv_k, 2016-04-05
@iv_k

in json, you can put a javascript object or an array of them, it can be heterogeneous, in various combinations of nesting.
there are 2 main functions to work with json
JSON.parse() // json->javascript
JSON.stringify() // javascript->json

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question