Skip to content

Failing to Evaluate filters with select #2

@ahmad-masalha

Description

@ahmad-masalha

var json = "[{\"id\":\"123\",\"name\":\"mytest\",\"email\":\"admin@gmail.net\"}]"
var query = ".[] | select(.name==\"mytest\") | .id == \"123\"";
var result = query.EvalToToken(receivedJSON);

Exception:

EvalToToken(receivedJSON)' threw an exception of type 'Sprache.ParseException'
Data: {System.Collections.ListDictionaryInternal}
HResult: -2146233088
HelpLink: null
InnerException: null
Message: "Parsing failure: unexpected '['; expected } (Line 1, Column 20); recently consumed: : .headers"
Position: {Line 1, Column 20}
Source: "Sprache"
StackTrace: " at Sprache.ParserExtensions.Parse[T](Parser`1 parser, String input)\r\n at Coeus.JQ.<>c__DisplayClass12_0.b__0(String _)\r\n at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)\r\n at Coeus.JQ.Eval(String jq, JToken token)\r\n at Coeus.JQ.EvalToToken(String jq, JToken token)"
TargetSite: {T Parse[T](Sprache.Parser`1[T], System.String)}

How can I overcome this bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions