Praveena DG
Praveena DG

Reputation: 143

Reading json response with .@. fails in feature file

This is my response.

`

 { 
"Response": {
"_": {
  "QueryResponse": {
    "_": null,
    "@": {
      "totalCount": "55"
    }
  }
},
"@": {
  "time": "2020-12-22T18:21:58.862-08:00"
}
}
}

`

I am doing this in feature file

* print "total count="+ result.session.runtimeData.read_count.Response._.QueryResponse.@.totalCount

and getting <eval>:1:78 Expected ident but found error result.session.runtimeData.read_taxcode_count.Response._.QueryResponse.@.totalCount ^ in <eval> at line number 1 at column number 78

^ points to @

tried enclosing it in [''] many places for the response but I am not able to get the value.

Upvotes: 1

Views: 39

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58058

Sometimes you don't need to complicate things, try this:

* def count = get[0] response..totalCount

Also this would have worked:

* def count = response.Response._.QueryResponse['@'].totalCount

Upvotes: 1

Related Questions