Question: I have the following query that gets the correct data, but it doesn't output it the way I would like.

The query is as follows:

```
DECLARE @xml xml = '<review><score>98</score><gameid>99</gameid><reviewdate>11/11/11</reviewdate><reviewtitle>Skyrim : A Real Masterpiece </reviewtitle><reviewdescription>Skyrim is the best open world-game ever made.</reviewdescription></review>';
DECLARE @dataCount int, @currentNodeIndex int;
DECLARE @outputTable TABLE (Rating nvarchar(max), GameId nvarchar(max), DateReviewed nvarchar(max), Title nvarchar(max), Description nvarchar(max));

SET @dataCount = @xml.query('count(/review/*)').value('.', 'int');
SET @currentNodeIndex = 1;

WHILE @currentNodeIndex <= @dataCount
BEGIN
  SELECT @xml.query('/node()[1]/node()[sql:variable("@currentNodeIndex")]/node()[1]').value('.', varchar(max)') as Temp
  FROM GameData;
  SET @currentNodeIndex = @currentNodeIndex + 1;
END

```

This generates the correct data, but like this:

```
Temp
 98

Temp
 99

Temp
11/11/11

Temp
Skyrim : A Real Masterpiece

Temp
Skyrim is the best open world-game ever made

```

I would like for this to display in one table, in one horizontal line, using the Alias created from the @outputTable

So like

```
Rating GameId DateReviewed Title Description

```

Any help would be appreciated.

Answer: 
You need either change your JSON to the following removing escaping symbols:

```
{
  "id":1047,
  "name":"City",
  "attribute_list":["RWC","HMO","SJ","Ensenada"],
  "list_type":1
}

```

or create [JsonConverter](https://www.newtonsoft.com/json/help/html/CustomJsonConverter.htm) for your type which will process your attribute\_list to the collection of strings
You can use Newtonsoft.Json

```
var files = JObject.Parse(YourJSONHere);
var recList = files.SelectTokens("$").ToList();
foreach (JObject item in recList)
{
   foreach (JProperty prop in item.Children())
     {
            string key = prop.Name.ToString();
            string value = prop.Value.ToString();
            // or do whatever 
     }
}

```