Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Original thread:
Post 2 made on Wednesday November 13, 2019 at 19:06
randman
Long Time Member
Joined:
Posts:
June 2003
370
I found two ways to do what I need:

1. Use json2.js from [Link: github.com] . All I had to do was pull json2.js, put it in my Pronto Libraries folder, and add the following lines to the top of the file:

/*!
@author douglascrockford
@title json2
@version 1.1
*/

This file provides JSON.parse() and stringify.

OR

2. Just use eval. For example:

var jsonObj = eval("(" + jsonText + ")");

I suppose JSON.parse is supposed to be more secure than just using eval, although non-native JSON.parse (like in json2.js) also uses eval. I suppose JSON.parse does do other checks. My use of JSON.parse is in response to user actions, so it's not something that's called often, and from my quick testing there is no noticeable negative performance impact of using JSON.parse.


Hosting Services by ipHouse