Process JSON with OWS

By Kateryna Sytnyk

December 24, 2008

Open Web Studio handles and simplifies consuming data in various formats.

To process external JSON request data make a JSON request in a Query action:


<JSON>
<PATH>http://pipes.yahoo.com/pipes/pipe.run?_id=9oyONQzA2xGOkM4FqGIyXQ&_render=json&feed=http://blog.usa.gov/roller/govgab/feed/entries/atom</PATH>
<GET><QUERY></QUERY></GET>
<COLUMNS>
<ROOT>value.items</ROOT>
<COLUMN><NAME>link</NAME><XPATH>link</XPATH></COLUMN>
<COLUMN><NAME>title</NAME><XPATH>title</XPATH></COLUMN>
<COLUMN><NAME>description</NAME><XPATH>description</XPATH></COLUMN>
<COLUMN><NAME>pubDate</NAME><XPATH>pubDate</XPATH></COLUMN>
<COLUMN><NAME>author</NAME><XPATH>author</XPATH></COLUMN>
</COLUMNS>
</JSON>


Similar to a database request, the query will return the set of entries. You can review the data you are consuming in this example simply by pasting <PATH> value in the URL bar.

 

{"count":30,"value":
{"title":"generic","description":"generic rss feed",
"link":"http://pipes.yahoo.com/pipes/pipe.info?_id=9oyONQzA2xGOkM4FqGIyXQ",
"pubDate":"Wed, 24 Dec 2008 07:31:03 -0800","generator":"http://pipes.yahoo.com/pipes/","callback":"",
"items":[
{"link":"http://blog.usa.gov:80/roller/govgab/entry/season_affective_disorder_sad",
"y:id":{"value":"http://blog.usa.gov:80/roller/govgab/entry/season_affective_disorder_sad",
"permalink":"true"},
"content":{"content":"<p>\"'Twas the night before Christmas and all through the house, not a creature was

.....

 

And similar to dealing with a regular query, in order to use the results build the handling logic inside the query action.

For instance, to write the returned URL to the database (assuming GetJSONData is the name of your query)

  • Before the query assign @URL Query Variable to [URL,Action] variable
  • Inside the query assign an Action variable URL to [link,GetJSONData]
  • Write to the database @URL

There is a complete demonstration of using a JSON object like a property bag available here with a complete configuration download.

 

 

Average (1 Ratings):
 
Want to help out?
 
 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seattle, WA • info@openwebstudio.com

Bookmark & Share Bookmark and Share