JSON

Syndicate content 18 

Hello,

 

I want to parse large JSON object and store data into persistent tables. Is there any other way besides pre-defining persistent classes including typing each property name? Maybe parse it and store properties into a global so that I know what properties need to be defined for each class...

 

Thanks in advance for your thoughts

Last answer 9 days ago
0   0 4
0

comments

123

views

0

rating

I am still new to cache objectscript and am trying to figure out how I would go about removing the escape characters from my JSON below. When I call the $toJSON method it's adding the "\" character in the file path.

 

{"FileStatus":"P","Path":"\/somepath\/test\/test123\/filename.txt","InterchangeOID":"100458"}

My Code:

Last answer 23 April 2019 Last comment 2 May 2019
0   0 5
210

views

0

rating

Referencing this post:

https://community.intersystems.com/post/producing-json-sql

I'm not sure how to actually interact with the result set I get from doing something like this.  I want to return something like:

[{"field1":1, "field2":2}, {"field1":2, "field2":10}]

I'm finding it very difficult to get it in this format, since %Print appends a newline onto the end of the {} object it prints.

Here's the closest I've gotten:

Last answer 13 April 2019 Last comment 16 April 2019
0   2 1
180

views

0

rating

Hi Dev Community,

My team is currently working on a project where we need to post pdf documents to a 3rd party REST API.

The API specifies a field in the JSON request message to contain the 'physical content' of the file as an array of bytes, example of the JSON request as follows - data truncated for readability purposes:

Last answer 12 April 2019
0   1 2
0

comments

154

views

0

rating

Dear Colleagues and Friends,

is there any indication that the .NET object representation of Cache objects (i.e. InterSystems.Data.CacheClient.dll) complies with .NET Standard? I'm planning to extend our existing .NET client/server solution with a mobile option by Xamarin Forms and can't find any significant hints in the internet.

I'm just fooling around a bit and made some expreiments with a REST API and a generic object-to-JSON tier:

Last comment 1 April 2019
0   0 2
0

answers

76

views

0

rating

Hello folks,

I have an JSON object that need to be updated before being parsed into a JSX component.

Source JSON obj:

var Obj = { "data": [
  {"id":1, "text":"Task #1", "project":"10", "sub_project":"10-1" },
  {"id":2, "text":"Task #2", "project":"10", "sub_project":"10-1" },
  {"id":3, "text":"Task #3", "project":"11", "sub_project":"11-1" },
]};

 

Required JSON obj result:

Last answer 7 March 2019
0   0 2
0

comments

90

views

0

rating

Hi All,

I am trying to get JSON data from a REST api.  I am using my web browser to get the data by hitting the URL.

The data is receiving properly, but the JSON contains a few HTML tags.

These tags are not not receiving in the browser while hitting the url. Is there any way to overcome this issue ?

Thanks,

Last answer 16 February 2019 Last comment 13 February 2019
0   1 3
108

views

0

rating

I created the Process to extract the required data from ADT message to a Dynamic Object. I wanted to send the JSON stream to EnsLib.File.PassthroughOperation operation and generate a file with the content of JSON stream.

Here are the codes for Process:

Last answer 12 December 2018 Last comment 9 January 2019
+ 1   0 3
212

views

+ 1

rating

Hi all,

I have an incoming JSON message with a string field exceeding in length the 'caché long-string limit' of 3641144 characters.

Using {}.%FromJSON(instream) I am able to create %DynamicObject properly. However, I am unable to access the long property, as in every assignment, I get the <MAXSTRING> error.

Is there any way for me to obtain contents of the 'too long' string field as a stream?

Thanks

Jiri

Last answer 28 November 2018 Last comment 9 November 2018
0   0 3
330

views

0

rating

When using the JSON_OBJECT() function in Caché SQL on a %String property that contains JSON syntax, it converts the %String into a JSON object instead of escaping it as a string literal. How can I prevent this? (without ridiculous hacks like "add a space to the beginning of the value" as we don't always know which properties will contain these values and I certainly don't want to have to check for nulls and add/remove a space every single place this value is used in the application)

I don't want these strings automatically marshalled into JSON objects.

For example:

Last answer 20 November 2018 Last comment 28 November 2018
0   0 3
188

views

0

rating

I am trying to use the automated unittest class for a %CSP.Rest service.

So my Unittest code set's %request and %response from %CSP.Req/resp respectively

I build a tProxy with the fields I need for the post and set it %ToJson... I have tried seting %request.Content = tProxy (and not)

 

I call the method for the post url directly... 

  When that method calls %fromJson to set an object with the info. I passed... 

      - when I don't set %request.content.. I get a error '5035 - premature end of data code 12'

Last answer 19 February 2018
0   0 7
401

views

0

rating

Hello everyone,

i want to create an iris document database with Atelier with some properties, where i can import my JSON formatted data from an API to the database which i created. Right now i know how to import my local JSON formatted data to my created database:

Last answer 4 October 2018 Last comment 7 October 2018
0   0 2
298

views

0

rating

Hi everyone,

I need submit a object have a json string as property of class, but I get an issue, object can't save to SQL table if I take json data to json property. I try making a test class with only json property and get the same issue, no data row in SQL table after run ClassMethod . Some one know what's problem, please help me. Here my test class:

Last answer 4 October 2018 Last comment 4 October 2018
+ 1   0 2
229

views

+ 1

rating

404 Not Found

{
"error": {
 "errors": [
  {
   "domain": "global",
   "reason": "notFound",
   "message": "Not Found"
  }
 ],
 "code": 404,
 "message": "Not Found"
 }
}

I want to do something like the above sample from a Google Storage JSON API. I have a call to Write obj.%ToJSON() followed by return ..ReportHttpStatusCode(..#HTTP404NOTFOUND) however the HTTP Status code is always 200.  If I remove the Write obj.%ToJSON() statement it returns a 404 status with no body. How do I return both?

Last answer 19 September 2018
0   0 3
0

comments

263

views

0

rating

Hi,

we have Angular solution and Cache server. We need to have separate users and sessions on same browser (laptop, table etc) for every user and for one user with many connections.

Thought this was resolved, but unfortunately not.

-----------------------------------------------------------------------------------------------------------------------

I got the code away from here, because it was some how ok.

The session on server mixed, but no any more, thanks our folk and local engineer's tools :)

Last comment 4 September 2018
0   0 1
0

answers

175

views

0

rating

Hi everyone,

I am still learning the platform for a student project and have to do some streaming and data analysis next. Since for my case I have no "live api" I wanted to just stream json files and output the data as it comes in from the files. (basically to emulate a incoming data scenario)

So thanks to the documentation and community posts I have figured how to create a stream and read data from a JSON but since I'm also new to JSON I have some parsing problems. I don't know how to access subarrays/sub-objects via objectscript.

Last answer 3 July 2018 Last comment 4 July 2018
0   0 2
425

views

0

rating