2

I want to convert Json Object to Json Array in Karate to use 'match each' func. I am getting to ('match each' failed, not a json array) error when I use match each func with Json Object.

Here is My Json Object:

{
  { "a": "q"
    "b": "w",
    "c": "t"
  },
  { "a": "x"
    "b": "y",
    "c": "z"
  }
}

And here is what I need:

  [  
    {
     { "a": "q"
       "b": "w",
       "c": "t"
     },
     { "a": "x"
       "b": "y",
       "c": "z"
     }
   }
 ]

1 Answer 1

2

Try this approach, using embedded expressions: https://github.com/intuit/karate#embedded-expressions

* def foo = { a: 1 }
* def list = [ '#(foo)' ]
* match each list == foo
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.