Is there a way to deal with a more complicated JSON structures?

First of all, thank you guys for the excellent plugin.
I've just installed a trial version and I'm almost sure that this plugin is exactly what I was looking for.
I still have one question.
According to PocketQuery documentation my REST service has to return an array. But sometimes I want to load and render a more complicated structure.
For example, my REST API returns an object with two fields:

  paging: ..pagination data object..
  content: ..result array..

I can render a data table by specifying JSON Path as "$.content" or using a custom converter. But I can't access "paging" object to extract paging.totalCount value. I know there is a rawResult variable defined, but it seems that rawResult is typed as java.lang.Object, and it's imposible to cast this variable to something like Map from velocity context. Any suggestions?

1 answer

Hi Max,

Thank you for your interest in PocketQuery! It's a very valid question! I'll try to explain from a more technical point of view: the way how PocketQuery deals with results after they were fetched is the specific data the array-of-objects style data structure that the results from your REST API should look like. When we developed 3.0, we were searching for a way to make this a convention, so we could handle all kinds of data sources (also: the results from SQL databases always look like this data structure using the libraries we use). So our decision was that also the results from REST APIs should be converted into this data structure. But the problem is that we can never know what the results from REST APIs will look like - the structure can be arbitrary.

That's why we came of with the idea of converters. The idea of a converter: it receives the raw results from the data source as input and returns the result in a format as we need it. So if you have your results in the format you describe, you'll have to write your own converter.

Converters look like this:

function convert(json) {


The json argument in that function is the json result retrieved from your data source using the given JSON Path ($.content) in your case. Now you need to parse this JSON string, convert it into an array-of-objects structure (with the column names as property keys) and return that structure.

For further information, please check our docs on converters.

Best, Felix

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


125 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you