private void JmesPathPipeExpression() { var expression = new JmesPathPipeExpression( new JmesPathIdentifier("foo"), new JmesPathIdentifier("bar") ); Assert(expression, "{\"foo\": {\"bar\": \"baz\"}}", "\"baz\""); expression = new JmesPathPipeExpression( new JmesPathSubExpression( new JmesPathIndexExpression( new JmesPathIdentifier("foo"), new JmesPathListWildcardProjection()), new JmesPathIdentifier("bar") ), new JmesPathIndex(0) ); Assert(expression, "{\"foo\": [{\"bar\": [\"first1\", \"second1\"]},{\"bar\": [\"first2\", \"second2\"]}]}", "[\"first1\",\"second1\"]"); Assert(expression, "{\"foo\": [{\"bar\": [\"first1\", \"second1\"]},{\"bar\": [\"first2\", \"second2\"]}]}", "[\"first1\",\"second1\"]"); expression = new JmesPathPipeExpression( new JmesPathIdentifier("foo"), new JmesPathIndex(0) ); Assert(expression, "{\"foo\": [0, 1, 2]}", "0"); }
public void OnPipeExpression() { Prolog(); System.Diagnostics.Debug.Assert(expressions_.Count >= 2); var right = expressions_.Pop(); var left = expressions_.Pop(); var expression = new JmesPathPipeExpression(left, right); expressions_.Push(expression); }