How to exclude a Json key

Hi all,

I am looking for a way to store a json response and remove a key, for example

{"menu": {
  "id": "file",
  "value": "File",
  "popup": {
    "menuitem": [
      {"value": "New", "onclick": "CreateNewDoc()"},
      {"value": "Open", "onclick": "OpenDoc()"},
      {"value": "Close", "onclick": "CloseDoc()"}
    ]
  }
}}
remove the key "popup"  from this json.


Thanks,
Martino


Hello guys,

any suggestions on this?

Thanks

I can think of couple of ways to do this

  1. Use checks to parse the entire JSON response and substring the resulting string. Then post that string back asJson. – http://gatling.io/docs/2.1.7/http/http_request.html#request-body
  2. Write your own JSON marshalling/unmarshalling function.

1st approach is easier. You can use the transform function when removing unnecessary keys. http://gatling.io/docs/2.1.7/http/http_check.html?highlight=transform#transforming