JSON Path Finder


This is a companion discussion topic for the original entry at https://store.katalon.com/product/20#qa-content

Hi everyone
I’ve installed the plugin, and it works fine to me. But i’d like to understand where and how i can effectively use the path the plugin shows. For example i’m trying to use it with jsonSlurper library as shown in the katalon docs, but I can’t make it work apparently.

Anyone knows any better how to use the path result given by this plugin?

The instructions also say that i’d have to change the “x” shown with my variable, but what does it mean? Which variable does it refer to?

Many thanks for every help

hey, you this is how you parse a json.

import groovy.json.JsonSlurper

String jsonString = ‘’’{“menu”: {

“id”: “file”,

“tools”: {

“actions”: [

{“id”: “new”, “title”: “New File”},

{“id”: “open”, “title”: “Open File”},

{“id”: “close”, “title”: “Close File”}

],

“errors”: []

}}}’’’

JsonSlurper slurper = new JsonSlurper()

Map parsedJson = slurper.parseText(jsonString)

String idValue = parsedJson.menu.id
or
String idValue2 = parsedJson.get(“menu”).get(“id”)