Skip to content

JSON_QUERY does not parse when WITH ARRAY WRAPPER is used #170

@naveennaik1

Description

@naveennaik1

Version - 170.121.2

Parser - TSql170Parser

When WITH ARRAY WRAPPER is used inside JSON_QUERY it does not get parsed with above mentioned parser version and details.

Steps to reproduce -

Try parsing the below SQL script with the parser:

SELECT JSON_QUERY(@j, '$.credit_cards[*].type' WITH ARRAY WRAPPER ) as credit_card_types;

Note : Example used is available on Microsoft documentation here
Example -

    static void Main(string[] args)
    {
        var script = "<Example Script>";
 
        var parser = new TSql170Parser(true, 0);
        var fragment = parser.Parse(new StringReader(script), out var parseErrors);
 
        if (parseErrors.Count > 0)
        {
            Console.WriteLine(parseErrors[0].Message);
        }
    }

Error message :-

Incorrect syntax near 'WITH'.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions