I need to create a basic string array from results - returned in JSON format from SQL Server.
An example JSON string I would want is:
[
{
"person": {
"name":"Jane Bloggs",
"previousSurnames": [
"Bloggy",
"Jones"
],
"Address":"I Live Here"
}
]
It is the "previousSurnames" I wish to retrieve as JSON but without any preceding labels... just a list of strings.
When I try the conventional way, it always puts the db field as the identifier (along with some extra curly braces which I also don't want!)...
[
{
"person": {
"name":"Jane Bloggs",
"previousSurnames": [
{"surname":"Bloggy"},
{"surname":"Jones"}
],
"Address":"I Live Here"
}
]
SQL Server must be able to do this as it recognises a simple string array as a correct JSON string e.g.
select isjson('["Bloggy","Jones"]')
returns 1 (Valid)
Help please...