... well... maybe not 101 ways, but there are several!
There is a lot of justified buzz around JSON. Many of us want to (or must) generate and parse JSON with PeopleSoft. Does PeopleSoft support JSON? Yes, actually. The Documents module can generate and parse JSON. Unfortunately, many of us find the Documents module's structure too restrictive. The following is a list of several alternatives available to PeopleSoft developers:
- Documents module
- Undocumented JSON objects delivered by PeopleTools
- JSON.org Java implementation (now included with PeopleTools)
PeopleCode can do a lot of things, but it can't do everything. When I find a task unfit for PeopleCode, I reach out to the Java API. PeopleCode has outstanding support for Java. I regularly scan the class and classes directories of PS_HOME, looking for new libraries I can leverage from PeopleCode. One of the files in my App Server's class path is json.jar. As a person interested in JSON, how could I resist inspecting the file's contents? Upon investigation, I realized that json.jar contains the json.org Java JSON implementation. This is good news as I used to have to add this library myself. So how might we use json.jar to generate a JSON file? Here is an example
JSON.org has this really cool fluent design class named
JSONStringer. If the PeopleCode editor supported custom formatting, fluent design would be really, really cool. For now, it is just cool. Here is an example of creating the same JSON using the
What about reading JSON using json.org? The following example starts from the JSON string generated by JSONStringer. It is a little ugly because it requires Java Reflection to invoke the JSONObject constructor. On the positive side, though, this example demonstrates Java Class casting in PeopleCode (hat tip to tslater2006 for helping me with Java Class casting in PeopleCode)
What is that you say? Your PeopleTools installation doesn't have the json.jar (or jsimple.jar) files? If you like this approach, then I suggest working with your system administrator to deploy the JSON.org jar file to your app and/or process scheduler's Java class path
Did you see something in this post that interests you? Are you ready to take your PeopleTools skills to the next level? We offer a full line of PeopleTools training courses. Learn more at jsmpros.com.
Hi Jim, Need some help on PeopleSoft Consuming JSON MQ message.
We configured JMSTARGET node and were able to establish the connection between MQ series and PS Local node as per PS documentation.
But we are not able to consume the JSON message. We tried to use Non-rowset message (as Peoplesoft don't have the ability to create message out of JSON Schema, we used online tool to convert JSON to XML and then got XSD and used in non-rowset creation). And created Service operation and added Handler code. But, we are not able to consume the message as it throws "Connection manager thrown General Framework Exception" error.
Then, we tried to use Document to create the message (Used same JSON Structure) and created the Service operation but when we try to consume message, it says "Unknown JMS message Format" on the error logs.
Could you please help me on to how to Consume MQ series JSON message using Document/non-rowset method?
I get lot of solutions from your blog
I have a fluid grid page for Table of contents for out Benefits groups.
This is showing all uploaded documents based on the benefit program for the self service employee
I would like to have accordion style for sub-topics (example - Medical category has 12 sub
category documents and do not want them to be shown until sub-categoty is expanded)
I want all categories to be dynamic. I tried with group "Accordion Vertical" for the main group box and "Accordion groupbox"
on the fluid tab but I am not getting the results right since they are like master child, in sub page fashion not like accordion (just under the parent category)
I can get the things working (accordion style)with basic html/css/java script as standalone but not able to make it work in Peoplesoft environment. I am wondering whether OracleJet library accordion has any different data source for the master and child boxes?
I appreciate your input on what could be the approach
Regards - AB Krishna
I tried the JSONStringer class in a couple of my services and it ended up taking twice as long to return the results as my implementation using the undocumented Elastic search classes.
I have several services that return 15+ meg json objects and the serialization speed is a huge pain point. I've had to resort to caching results via a clob in the database in order to stream the data to our consuming apps quickly (minutes vs. seconds). I really wish there was a faster way so that I ditch caching.
This is great feedback and I completely agree! The PeopleSoft apps and tools team are both recognizing the need for good JSON support. We see this with elastic, cloud chatbot service, etc. I fully expect better, documented JSON support, and I definitely do not mean the documents module.
@AB, I think the key word there is "dynamic." There is nothing dynamic about the PeopleTools delivered Fluid Accordion. I actually wonder why they delivered it because you notice Navigation Collections and activity guides don't use it, but use something that looks and works much better. Yes, I would look else where for this functionality, especially since you want it to be dynamic.
Is it possible to create a JSON that starts with collection in Peoplesoft?
I tried to add the root element into the JSON array but peopelsoft is appending by default the curley bracket:
Howdy. Tried this but I am getting
Java Exception: java.lang.NoClassDefFoundError: org/json/JSONObject: finding class org.json.JSONObje ct (2,725)
Is this specific to a tools version - we are on 8.54
Yes, this is tools specific. I believe the Java classes were added to support Elastic Search and therefore may not exist in earlier PeopleTools releases.
@Nilay are you using the Documents module? It is not flexible. If you start from a JSONArray, however, you will not get JSONObject notation. It looks like you may be starting from JSONObject.
@Sudheer, I don't know that you will be able to use the Documents module or rowset based message to do this. I would be more likely to use an unstructured, non-rowset based message, which will give you a string, and parse the contents using a true JSON parser.
Do you know if this is available in 8.56?
Yes, absolutely! Every single one of these methods is available in 8.56.
We have created a REST web services and response in JSON message. Whether document builder in PeopleSoft can create a dynamic JSON structure? for example document has three collection A, B,C. I have to send only the data in A, C or B,C based on the request. We are in 8.57
I don't know that you can make the Document dynamic, but you can create multiple documents and choose which one to generate. If the Service Operation is attached to an unstructured message, then it works perfectly. This would not work with a Service Operation attached to a Document-based message. Easy fix, though, just change the Service Operation (or create a new version).
Thank you so much for sharing. We are on PeopleTools 8.51, do you know what is the good way to process JSON? Thank you!
@Jie, on 8.51, it is not easy but is possible. I think a Java library would be easiest. I have had great success with the org.json JSON classes and JSON.simple. We documented JSON.simple in our PeopleTools Tips and Techniques book written on PeopleTools 8.49.
Post a Comment