Over a million developers have joined DZone.

JSON Data Services

DZone's Guide to

JSON Data Services

· Web Dev Zone
Free Resource

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

Want to specify an SQL statement and a corresponding URI pattern, and create a RESTful JSON Data Service with just one line of configuration?

The Free and Open Source UltraESB v1.3.0 introduces JSON Data Services which does exactly this! Create data services by specifying a SQL query and a URI pattern. The URI patterns allows you to specify variables, that correspond to the SQL statement as shown in the following example.

URI Pattern:  /byDeptAndDivision/{department:INTEGER}/{division:INTEGER}?{age:INTEGER},{sex:VARCHAR}

SQL: select * from employee where division = :division and department = :department and sex = :sex and age > :age

The results of the SQL are converted into a JSON response and returned. Read the full article that shows many examples with a hypothetical employee database.

 Your configuration for the above mentioned RESTful JSON Data Service maybe as simple as shown below:

<u:proxy id="basicEmployeeService">
<u:transport id="http-8280"/>
mediation.processBasicJSONDataServiceRequest(msg, "empJsonSvc", "dataSource");

<bean id="empJsonSvc" class="org.adroitlogic.ultraesb.core.helper.BasicJSONDataService" init-method="init">
<property name="queryMap">
<entry key="/getPermanentEmployees" value="select * from employee where permanent = 1"/>
<entry key="/byDeptAndDivision/{department:INTEGER}/{division:INTEGER}?{age:INTEGER},{sex:VARCHAR}"
value="select * from employee where division = :division and department = :department and sex = :sex and age > :age"/>

Now, issuing a GET request such as : 

GET http://localhost:8280/service/basicEmployeeService/byDeptAndDivision/2/3?age=20&sex=male

will get you the result set as JSON. (Note that the service context path, service name or URL pattern can be customized as required)


The UltraESB supports the creation of REST services that updates the database as well using the HTTP PUT, POST and DELETE methods.

Read the full article that shows the creation of multiple functions for a JSON Data Service at the AdroitLogic web site

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.


Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}