Filtering Json into a JSP - json

Hy!
I need to know how can I filter/parse some json data into a JSP.
It would be in order to create a kind of 'little' API.
I have made one test via PHP, the thing goes like that.
I send a parameter to an URL like this
records.php?artist='tame impala'
In my php file first I proceed to trim the parameter artist, then I compare to a JSON will all the records and finally I print only the records from 'tame impala'.
Is it possible to do that in a JSP file without any servlet or similar?
Thanks a lot!

Related

Request for example server side generated JSON for HPP integration

I'm trying to use a full page redirect with a direct integration and if I'm reading the documentation correctly I believe I should be able to generate the server side JSON to pass into RealexHpp.redirect. I know the code to generate this JSON is shared in a number of languages, but is the raw JSON output shared anywhere? I ask as the language I'm writing in isn't one of the ones covered, so I'm trying to make sure I get the output format correct.
I've tried re-creating the JSON structure based on what I believe the Java code displayed should output, but I'm obviously doing something wrong as its not working, would be really useful if I had some raw JSON to compare it against to make sure I'm getting the structure right.
Many thanks,
Raw JSON examples are not available, but we do have HTML POST examples (https://developer.globalpay.com/hpp/card-payments). You can build a JSON based on these.
This is how the JSON should look like: {"MERCHANT_ID":"MerchantId","ACCOUNT":"internet","ORDER_ID":"N6qsk4kYRZihmPrTXWYS6g","AMOUNT":"1999","CURRENCY":"EUR","TIMESTAMP":"20221121100715","AUTO_SETTLE_FLAG":"1","SHIPPING_CODE":"50001|Apartment 825","SHIPPING_CO":"US","HPP_SHIPPING_STREET1":"Apartment 825","HPP_SHIPPING_STREET2":"Complex 741","HPP_SHIPPING_STREET3":"House 963","HPP_SHIPPING_CITY":"Chicago","HPP_SHIPPING_STATE":"IL","HPP_SHIPPING_POSTALCODE":"50001","HPP_SHIPPING_COUNTRY":"840","BILLING_CODE":"59|123","BILLING_CO":"GB","HPP_BILLING_STREET1":"Flat 123","HPP_BILLING_STREET2":"House 456","HPP_BILLING_STREET3":"Unit 4","HPP_BILLING_CITY":"Halifax","HPP_BILLING_POSTALCODE":"W5 9HR","HPP_BILLING_COUNTRY":"826","HPP_CUSTOMER_EMAIL":"james.mason#example.com","HPP_CUSTOMER_PHONENUMBER_MOBILE":"44|07123456789","HPP_PHONE":"44|07123456789","HPP_ADDRESS_MATCH_INDICATOR":"FALSE","HPP_VERSION":"2","SHA1HASH":"308bb8dfbbfcc67c28d602d988ab104c3b08d012"}

Jenkins API xpath like functionality for JSON

I am trying to use the jenkins API to retrieve a list of running jobs buildURLs and this works with this the query
https://jenkins.server.com/computer/api/xml?tree=computer[executors[currentExecutable[url]]]&depth=1&xpath=//url&wrapper=buildUrls
By searching for all executors on given jenkins server and then grabbing the urls and wrapping them in a xml buildUrls object
(what I actually want is a count of total running jobs but I can filter in api then get a .size of this once client side)
However the application I am uses only accepts json, although I could convert to json I am wondering if there is a way I can have this return a json object which contains just the buildUrls. Currently if I change return to json the xpath modification is removed (since its xml only)
And I instead get returned the list of all executors and their status
I think my answer lies within Tree but i cant seem to get the result I want
To return a JSON object you can modify the URL as below
http://jenkins.server.com/computer/api/json?tree=computer[executors[currentExecutable[url]]]&depth=1&pretty=true
It will not be possible to get only the build urls you need to iterate through all the executables to get the total running jobs. The reason is that build urls alone cannot give you information where it is running. Hence, unfortunately we need to iterate through each executor.
The output you will get is something like below.
Another way of doing this same thing is parsing via jobs
http://jenkins.server.com/api/json?tree=jobs[name,url,lastBuild[building,timestamp]]&pretty=true
You can check for building parameter. But here too you will not be able to filter output from url diretly in jenkins. Iteration would be required through each and every job.

Parse APEX RESTful WebService reference JSON response stored in CLOB001 column

I am trying to generate a report page in my APEX application, using the data obtained from a REST service response.
I added a new RESTful webservice reference and sepecified a JSON output.
Then I've generated a query/report page, but this is what's being currently displayed:
Instead I want the report to display the contents of data field on the JSON response (A single row with various columns and values)
Is there any straight forward way to show each response element and field on its row and column instead of a single column and row with the whole response, like there is with XML RESTful responses?
Consider whether another output type may be more handy. If you're putting out JSON and expect to handle it in PLSQL, then you do need to realize that PLSQL does not handle that natively.
Want to handle the rest response as json in plsql? Then look into some PLSQL libraries/projects that may do this:
http://reseau.erasme.org/pl-sql-library-for-JSON?lang=en
http://sourceforge.net/projects/pljson/
Then print out the returned HTML through HTP.P calls.
Though honestly, if you want to stick with plsql you would be much better off using XML as a return type, since you can then use all the xml goodies in the database. Though simply spitting out some html structure may not be quite too interesting (but I digress).
Or call the rest service through an ajax call from javascript, and handle the object there. After all, JSON is Javascript Object Notation and should be perfect for javascript, right? Then simply inject your html somewhere in the document. Ideally you would set up a region as a container for this.

querying json at the back-end

I'm building an app with Angularjs with its data stored on json files, so basically i just $http them and have them sorted into the templates.
It was perfectly fine when every .json was ~2kB, now it's over 20kB, so i'm thinking of separating the various parts of the json files into smaller chucks so that every chunk would be exactly what the client needs to receive in order to view a single page in the app (or state) and nothing more. But i want to keep the files as they are, if that's possible.
So, this my question then - is it possible to query json files at the back-end and send to the client only the queried part of it? And if so, how?
Thanks
the only way that I can think of is to use a server side code for that.
For example if we use PHP on the server side it would be something like this:
$string = file_get_contents("file.json");
$json_a = json_decode($string, true);
// server side pagination
The do some classic server side pagination.

Is it possible to write data to JSON with Extjs4?

Is it possible to write data to JSON without php/asp, only ExtJS? Can someone provide simple example of how to do this (sending form data to Json)?
Where do you want to store your json data exactely ?
Since you don't want to use a server-side script to back it up, I presume it's client-side.
Then I'd say a combination of Ext.data.writer.Json + one of the following :
Ext.data.proxy.LocalStorage
Ext.data.proxy.Memory
Ext.data.proxy.SessionStorage