Question
· Jun 1, 2017
Casting JSON

I'm doing a REST service. A method has as body parameter a JSON corresponding to a class A.

In my production I have class A so that I retrieve the parameters using a dynamic object, such that:

Set body = ##class(%DynamicObject).%FromJSON(%request.Content)
Set myObjectA = ##class(A).%New()
Set myObjectA.Id = body.Id
Set myObjectA.Name = body.Name
Set myObjectA.Date = body.Date
Set myObjectA.Salary = body.Salary

I would like to know if I can avoid doing the manual mapping, doing a casting, since I am sure that FromJSON will return a class A. Something like this:

0 9
1 861

I am using studio 2015 version which does not have dynamic objects and I need to read xml and convert that to a json I have managed to come close to json string but with little difficulties .I need to be able to identify the root element and specify where to put braces between objects anyone with any idea is welcome he is my code so far

1 12
0 1.4K

Hi Guys,
Can you please guide me to get rid of this issue. Please find the image files with this post.

Please let me know, before we are developing an API what are all the setup/Configuration(Apache/web server) need to do in my machine.

If any lead would be appreciated.

I don't know, in XMLNamespace parameter which URL need to use.

.

Thanks,

0 3
0 481

Hi , i have a JSON record as follow {value1,value2, value3}

i want to write my switch statement in this form:

<switch> my value
<case> value1</case>
<case>value2</case>
<case>value3</case>
​</switch>

is there any possibility to extract values from JSON record and put them in a switch statement?

thank's

0 1
0 2.1K

Hi guys,

How do you deal with underscore characters when using jsonProvider and exporting or importing ?

for example:

USER>s jsonString="{""what"":""1"",""up"":""2"",""test_test"":""3""}"
 
USER>set status = ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(jsonString,,.outputObj)
 
USER>w outputObj.what
1
USER>w outputObj.up
2
USER>w outputObj.test_test
 
W outputObj.test_test
^
<UNDEFINED> *test

we found out that we can access it like this, but not sure if it's the recommended method-

0 11
0 503
Question
· Apr 1, 2017
XML to Json conversion

Hello,

Are there any utilities/api in HealthConnect 2016.2.1 that will allow conversion of XML virtual document to Json format? We were thinking to convert HL7 ADT message to XML via Ensemble DTL and then send it to another BP to convert to Json format for transmission via Web Services. To my understanding there isn't anyway to represent Json as a virtual object so it can be use for direct mapping of HL7 2.x message to Json via Ensemble DTL.

Thanks

Yuriy

0 3
0 2.6K

Hi all,

We faced a problem where we would like to map a $lb object to its corresponding data model structure in order to later on export it as JSON.

So imagin that we have something like this that actually maps to a persistent table with its structure.

$lb("",,,,,"",,,"BOOLEAN","0",2,2,"1",,"bla",$lb(,,"bla","20050502123400"),"",1,"bla",,0)

Is there a way to transform this $lb (without the need of openig the object itself) to a JSON object with the proper table fields as properties?

Many thanks

0 9
0 397

Hello...

I need to convert a array (JSON) in a List Of String. I think, there is some method that does it directly.

Something like that:

SAMPLES>set list = ##class(%ListOfDataTypes).$fromJSON("[""a"",""b"",""c""]")

%FromObject+21^%Library.RegisteredObject.1 *%Exception.General Compose Compose %FromObject Unable to map frm %Library.Array instance to %Library.ListOfDataTypes

I have reading about this but I don't found some trick to help me.

0 1
0 530

Hi All,

I use SQL function JSON_OBJECT to get data as a JSON object.

However, sometimes I get error with function JSON_OBJECT when values contain [, ], { or }.

Error:

[SQLCODE: <-400>:<Fatal error occurred>]

Unexpected error occurred in JSON_OBJECT() function execution of <JSON_OBJECT>.%FromJSON().Parsing error

For example,

Query: SELECT JSON_OBJECT('idSQL':id, 'content':content) FROM DocBook.block

0 9
0 1.3K
Question
· Mar 24, 2017
Convert to JSON string

here is my $ZV string "Cache for Windows (x86-64) 2016.2.1 (Build 803) Wed Oct 26 2016 12:43:35 EDT"

two questions

1. How do i convert any Persistent object to JSON String ?

2. How do i convert an y Register object to JSON string ?

3. Do i need to extend from any adaptor class for 1 & 2 ?

0 11
0 4.6K

Hi everyone, I have and Zen Mojo application, it's all working but I have some doubts about what is recommended to use: There is some reports of employees, for example, and actually I'm using some plugins : "Excelent export" to generate Excel reports and "jspdf" to generate PDF reports in client side.

I have an REST service, that receives the request, process and returns JSON, after client side receive the response it's processed.

- This can be slow/bad in applications with large data?

- It's better/recommended to use ZenReports even with ZenMojo applications?

1 2
0 359