What’s the trick to build a JSON string
What’s the trick to build a JSON string
Now that the new build is out, and the REST process will properly send a JSON string, is there a particular strategy or technique that makes building this potentially long string easy?
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: What’s the trick to build a JSON string
One option would be to use a query widget type or settings to generate results in JSON, or use a FIND function (query) with a CONVERT_TO_JSON function. Then store the string parameter.
The other, Aware IM to convert XML to JSON then save it in an attribute?
Converting Java objects to JSON with Jackson
XML to JSON Converter
The other, Aware IM to convert XML to JSON then save it in an attribute?
Converting Java objects to JSON with Jackson
XML to JSON Converter
Re: What’s the trick to build a JSON string
Generally speaking, JSON construction is part of the framework, i.e. AwareIM. In other systems you simply tell the system how your input/output format should be, like XML or JSON and the system does it.Jaymer wrote:Now that the new build is out, and the REST process will properly send a JSON string, is there a particular strategy or technique that makes building this potentially long string easy?
Re: What’s the trick to build a JSON string
Jaymer -- are you referring to build 2465?Now that the new build is out
Tom - V8.8 build 3137 - MySql / PostGres
Re: What’s the trick to build a JSON string
yes, 2465 fixed this 1 issue with JSON strings
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: What’s the trick to build a JSON string
Well, since I'm using MS SQL SERVER, I can take advantage of "FOR JSON" on a SELECT statement and it makes pretty JSON for me.
Couldn't be happier.
jaymer...
Couldn't be happier.
jaymer...
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
-
- Posts: 197
- Joined: Fri Jun 17, 2016 7:10 am
- Location: Brisbane Australia
- Contact:
Re: What’s the trick to build a JSON string
A trick we have used in AwareIM to get data into a JSON string is
1. Publish an AwareIM REST Service that outputs as JSON
2. Call that Service using the AwareIM’s URL_CONTENTS function to call the local REST request
1. Publish an AwareIM REST Service that outputs as JSON
2. Call that Service using the AwareIM’s URL_CONTENTS function to call the local REST request
Code: Select all
Object.JSON_String = URL_CCONTENTS(‘http://localhost:8080/REST SERVICE ADDRESS’)
AWS Linux, Windows Server, AIM 8.4 & 8.6
Re: What’s the trick to build a JSON string
Kendo UI offers JSON through spreadsheets. I think Aware has the spreadsheet feature.
Store Data as JSON
The Spreadsheet allows you to store and load data in a native JSON format.
https://docs.telerik.com/kendo-ui/controls/data-management/spreadsheet/import-and-export-data/json
Could this be of any use, if so, how?
From the How-to guide (p41):
How to work with embedded spreadsheets
Store Data as JSON
The Spreadsheet allows you to store and load data in a native JSON format.
https://docs.telerik.com/kendo-ui/controls/data-management/spreadsheet/import-and-export-data/json
Could this be of any use, if so, how?
From the How-to guide (p41):
How to work with embedded spreadsheets
Support, if the spreadsheet stores the data in JSON format, could this document attribute be used as a parameter string in context?To use embedded spreadsheets in Aware IM you need to do the following:
- Define an attribute of the Document type in some object
-
- Posts: 7525
- Joined: Sun Apr 24, 2005 12:36 am
- Contact:
Re: What’s the trick to build a JSON string
Here is one idea how you can get JSON representation of Aware IM records using the current Aware IM version. This is an idea only, we haven't tested if it works.
1) Define an Aware IM service that is implemented using REST
2) Define the reply of this service to return the object(s) you want converted into JSON
3) Define JSON as the format of the reply. Define name mapping and other JSON conversion parameters as required
4) The process that implements the service should find the instance(s) that you want to convert to JSON and put them in Context
5) Call the service using the URL_CONTENTS function where the URL specified in this function is the URL of the service exposed above
6) The URL_CONTENTS function should return JSON representation of the record(s)
If this doesn't work let us know why and we may fix the problems, so that this approach can be used for JSON conversion
1) Define an Aware IM service that is implemented using REST
2) Define the reply of this service to return the object(s) you want converted into JSON
3) Define JSON as the format of the reply. Define name mapping and other JSON conversion parameters as required
4) The process that implements the service should find the instance(s) that you want to convert to JSON and put them in Context
5) Call the service using the URL_CONTENTS function where the URL specified in this function is the URL of the service exposed above
6) The URL_CONTENTS function should return JSON representation of the record(s)
If this doesn't work let us know why and we may fix the problems, so that this approach can be used for JSON conversion
Aware IM Support Team
Re: What’s the trick to build a JSON string
Is anyone going to try Vlad's suggestion?
Since I got my JSON output figured out, I don't have time right now-I'm busy working on other REST issues.
If someone DOES decide to tackle this, please leave a msg here so we don't duplicate effort.
Since I got my JSON output figured out, I don't have time right now-I'm busy working on other REST issues.
If someone DOES decide to tackle this, please leave a msg here so we don't duplicate effort.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: What’s the trick to build a JSON string
Isn't Vlad's suggestion the same as UnionSystems a few post up except with a some more details.
Bob
-
- Posts: 7525
- Joined: Sun Apr 24, 2005 12:36 am
- Contact:
Re: What’s the trick to build a JSON string
Yes, it's the same. Sorry, UnionSystems, didn't see your post (but great minds think alike )
Aware IM Support Team
Re: What’s the trick to build a JSON string
Cannot get steps 5 & 6 to work.
com.bas.shared.ruleparser.ParseException Unable to retrieve contents of the URL due to exception java.io.IOException Server returned HTTP response code: 500 for URL: http://localhost:8081/AwareIM/REST/CR/SI_REST_Service
com.bas.shared.ruleparser.ParseException Unable to retrieve contents of the URL due to exception java.io.IOException Server returned HTTP response code: 500 for URL: http://localhost:8081/AwareIM/REST/CR/SI_REST_Service
Re: What’s the trick to build a JSON string
I'm getting Rest 500's now also, per this thread.
https://www.awareim.com/forum/viewtopic.php?f=1&t=10473
https://www.awareim.com/forum/viewtopic.php?f=1&t=10473
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
-
- Posts: 7525
- Joined: Sun Apr 24, 2005 12:36 am
- Contact:
Re: What’s the trick to build a JSON string
Check out the output of Tomcat and the Aware IM Server for clues.
Aware IM Support Team