Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Posts: 134
Registered: ‎11-27-2012
My Device: Z10 LE,Dev Alpha C

Document NEEDED for the JSON_Reader lib when creating webworks ext


I can't find any documents anywhere.


I want to process some json file


for Example:

{"message":" data get error",


WebWorks Developer
BlackBerry Development Advisor
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: Document NEEDED for the JSON_Reader lib when creating webworks ext

[ Edited ]

If I'm understanding correctly, you have JSON in a file and wish to use it in your application, is that right?


You should be able to use an XMLHttpRequest to retrieve the file and you can then call JSON.parse() on the returned string to create the JSON object. This would give you a JSON object you can work with inside your application.


There is a good tutorial on XHR here:


And a specific JSON example in the cross-domain request section of the tutorial.


var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://www.example2.com/hello.json');
xhr.onload = function(e) {
  var data = JSON.parse(this.response);

Source: http://www.html5rocks.com/en/tutorials/file/xhr2/



EDIT: Regarding JSON_Reader lib and WebWorks extensions, can you provide more information about this library? Which are you exactly looking to implement, is this a BlackBerry library or a third-party library?

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.