SQL Server FOR JSON Path Nested Array -


we trying use json path in sql server 2016 forming nested array sql query.

sql query:

select a,  b.name [child.name], b.date [child.date]  table 1 join table 2 on table 1.id=table 2.id json path 

desired output:

[{ a:"text",    "child:"[          {"name":"value", "date":"value"},          {"name":"value", "date":"value"}         ] }] 

however getting is:

 [{     a:"text",     "child:" {"name":"value", "date":"value"}   }, {    a:"text",   "child":{"name":"value", "date":"value"} }] 

how can use json path form nested child array.

instead of join use nested query, e.g.:

select a, child=(select   b.name [child.name],   b.date [child.date] table 2 table 2.id=table 1.id json path) table 1 json path 

(the query in question broken af query broken should give idea)


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -