0

Assuming I have the following object:

var data =
[
{"x.y":"X Y"},
{"x.y.a":"X Y A"},
{"x.y.b":"X Y B"},
{"x.y.c":"X Y C"},
{"d.e":"D E"}
];

How can render them in HTML like the following with jQuery?

x:
 y:"X Y"
  a:"X Y A"
  b:"X Y B"
  c:"X Y C"
d:
 e:"D E"
5
  • What is the data? are you trying to create an array of nested object? If so, this is not correct. Commented Jan 30, 2016 at 2:00
  • The data is returned from an ajax call. It is an array of objects. I need to render them on the front end according to the json 'key' name. Commented Jan 30, 2016 at 2:02
  • 1
    It does not matter where the data is coming from. variable data does not have a valid structure. fix it and then we can have a nice loop to generate li list Commented Jan 30, 2016 at 2:08
  • look into this link: stackoverflow.com/questions/17546739/… Commented Jan 30, 2016 at 6:05
  • { "x.y": "X Y", "x.y.a": "X Y A", "x.y.b": "X Y B", "x.y.c": "X Y C", "d.e": "D E" } Commented Jan 30, 2016 at 6:17

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.