Home > [old] Information > Archives > Technologies > Archives > PL/SQL > pl/sql library for JSON
pl/sql library for JSON
pl/sql library for JSON
Monday 3 December 2007
All the versions of this article: [English] [français]
Here is the first release of a PL/SQL package for JSON (Javascript Simple Object Notation). This program is published under the GNU LGPL License.
The package’s features are :
– create and manipulate JSON objects
– add attributes and array to a JSON object
– convert from JSON to string
– convert from String to JSON structure
– debugging function
– customizable output (web or custom)
a little test procedure gives an idea of capabilities of this package.
The 1.1 version has released. Here the changelog between 1.0 and 1.1
– Add some stuff to prevent from javascript Hijacking, prototype framework compatible :
/*-secure-\n{...json object...}\n*/
– Add procedure to send appropriate mime type for Web output "application/json"
– printing enhancement.
– suppress global variable g_output_type.
– bug corrections in String2Json func.
– Add procedure to stream out the json object
– Suppress indentation for better perf on long json objects.
– Refactor terms to match on the english terms
– bug correction in getAttrValue, add param pOutPutStringDelimiter and pOutPutSeparator
that allows to format the output of the function.
– Add function getAttrArray that return an array of values in an plsql array of varchar2
– Add Array2String utility.
– Add License informations
The 1.0 version has released.
– Added a basic validation function to validate struture of JSON objects.
Any message or comments?
You must be registered before participating in this forum. Please enter your personal identifier . If you have not yet registered, you must register.
back.projets.erasme.org
Forum posts
1. pl/sql library for JSON, 9 January 2008, 13:46, by Bernard
Hello
Thanks for this nice pl/sql implementation of JSON. I will evaluate if I can use this.
Remarks:
– affiche.p(p_str); is not known on my database
– there is a problem with &p_rendertype when I execute the body in sql+. You should add
set define off
at top of the file.
Thanks,
Bernard
1. pl/sql library for JSON, 14 February 2008, 10:45, by Pierre-Gilles Levallois
– affiche.p(p_str) is my custom procedure that push out the data to the http stream.
I think you should use htp.p which is the standard way using Oracle Web Toolkit, to push your results to the http stream.
– problem of "&p_rendertype" : You’re right. I did not pass the script with Sqlplus (Sqlplus is the problem !) I use TOAD to develop packages and that’s why I did not see this problem.
Let me know if you have some other difficulties.
Best regards.
2. pl/sql library for JSON, 29 July 2011, 15:13, by mivpl
there is a problem with &p_rendertype when I execute the body in sql+. You should add
Seo Services
2. pl/sql library for JSON, 8 October 2008, 18:41, by psehgal
Do you happen to have any documentation on this?
Praveen
View online : JSON for Moving 20.com
1. pl/sql library for JSON, 9 October 2008, 09:52, by Pierre-Gilles Levallois
Sorry, there’s no user documentation for the moment but you can have a look at the test procedure (json.test). It shows how to create and manipulate JSON object with this package.
I promise to work on a doc when I have time to do this, but I can’t tell you when I will have written it.
2. pl/sql library for JSON, 29 August 2010, 04:34, by Mark Harrison
Thanks for this package.
Here is a simple "hello world" which might be useful to show.
Can you tell me how to create a simple list, such as:
[]
[1,2,3]
but not as part of a dictionary?
Thanks!
Mark
http://codehaus.blogspot.com/2010/08/hello-world-for-erasme-plsql-json.html
declare
my_obj json.JSONStructObj;
my_tab json.JSONArray;
begin
— empty dictionary: {}
json.newJSONObj(my_obj);
json.closeJSONObj(my_obj);
dbms_output.put_line(json.JSON2String(my_obj));
— dictionary ’x’:’hello’,’y’:99
json.newJSONObj(my_obj);
my_obj := json.addAttr(my_obj, ’x’, ’hello’);
my_obj := json.addAttr(my_obj, ’y’, 99);
json.closeJSONObj(my_obj);
dbms_output.put_line(json.JSON2String(my_obj));
end;
3. pl/sql library for JSON, 30 August 2010, 11:09, by Pierre-Gilles Levallois
Hi Mark,
Here is a sample code that generates onlyan array.
Just have a look on the "p_only_an_array" parameter. It is set to "true".
For more sample, you can run the json.test procedure on your web server.
3. pl/sql library for JSON, 9 October 2008, 09:41, by Ron Mey-Ami
Thanks this package is very useful for working with PL/SQL and JSON objects.
Good job!
4. pl/sql library for JSON, 10 January 2011, 03:45, by Ferris Malle
This will be very helpful for me since I am about to apply as a web developer and I am a fresh graduate so I have to step up my game in order to get accepted even if all other applicants has more impressive resumes than I am. What I lack in experience, I would make up for it by researching as much as I can about Information Technology.
5. pl/sql library for JSON, 4 March 2011, 06:02, by kswaby10
Thanks a whole lot for this. This will help me quite a bit with the Java based car games i’m currently working on. Thx again.
6. pl/sql library for JSON, 6 May 2011, 11:18, by MichaelBurr
Thanks for opportunity of downloading. Maybe some more example essays for deeper understanding how it’s work.