JSON

Syndicate content 17 

With the release of Cache 2016.1, JSON support was re-architected and made part of the core object model with the creation of %Object and %Array classes, which allow you to create dynamic JSON enabled objects and arrays.

On a recent demonstration I was working on, I had the need to create a REST web service that returned a JSON representation of a persistent object.  After searching for methods that would allow me to accomplish this, ultimately I found none, until now.

With the release of 2016.2 (currently in beta) we introduce the Document Data Model along with SQL enhancements that allow you to query the documents and intermix the information within the document model with data contained within existing relational tables.  Those same SQL enhancements can be used to create a JSON representation of a persistent object

Last comment 22 December 2017
+ 3   0 10
1368

views

+ 3

rating

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

Last answer 1 December 2017 Last comment 4 December 2017
+ 1   0 1
534

views

+ 1

rating

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,

Arun Kumar Durairaj.

Last answer 1 December 2017 Last comment 1 December 2017
0   0 2
195

views

0

rating

How do I set an URL when I post a httpRequest via SendFormArray of my Ensemble Business Operation. Here is my code: 

Class CareHome.RestApiClient Extends EnsLib.REST.Operation
{

Parameter INVOCATION = "Queue";

Method Login(pRequest As CareHome.Request.LoginRequest, Output pResponse As Ens.StringResponse)
{

Last answer 27 November 2017
0   0 1
0

comments

318

views

0

rating

If you want to dynamically serve images as a property of JSON then there is no perfect encoding solution. One method used frequently is to Base64 encode the image. Whilst there are some negatives to doing this, such as data inflation, there are some positives to working with Base64 images inside the browser.

Let's say you have an image placeholder on a web page...

<div id="image-container"><div>


And you fetch a JSON message from the Caché server containing the image as one of its properties...

var msg = JSON.parse(client.responseText);


Without needing to decode the image data you can create an img element and append it directly to the place holder..

Last comment 7 November 2017
+ 6   1 5
869

views

+ 6

rating

The Widgets Direct sample application highlights many aspects of how to use InterSystems technologies to build a modern web application.  Features include:

  • Angular Material + AngularJS + JSON + REST based interactive application with Step by Step instructions on how it was built
  • Example scripts for server-side source control configuration with Perforce
  • %UnitTest logic for automated regression testing
  • %Installer class for automated instance installation from source control 
  • Scripts for Continuous Integration (CI) with Jenkins
  • Docker Manifest for automated provisioning of an instance

We will be adding articles which discuss the above list of features to drill down in more detail on each topic (feel free to  comment if there is something you want to see done sooner rather than later)

Last comment 23 October 2017
+ 5   0 6
839

views

+ 5

rating

Hi, Community! 

Check a new  session recording from Global Summit 2017:

Angular, JSON, and REST – Oh My!

 

0   0 1
0

comments

308

views

0

rating

One of the most important features during application development is the ability to debug your code easily. Because of the asynchrnous nature, a standard Node.js application server works single-threaded by default. When you are developing applications using an IDE like Visual Studio Code, you can very easily debug your Node.js process:

First, download the free Visual Studio Code IDE (@code) and install it on your development machine.

We will start with basic debugging using a very small test.js file and go to the debug view:

You'll notice we need to define a debug configuration first (at the top, click on "No configurations" and select "Add configuration". You'll see a "launch.json" file is created and select "Node.js: launch program":

+ 3   0 2
0

comments

963

views

+ 3

rating

I've mentioned the QEWD project in this group before: it's a Node.js-based platform for web, Native and REST applications which tightly integrates with Cache.  It uses a somewhat different philosophy to the use of Node.js than the norm, and I've now published an article that explains this approach and the unique benefits that arise as a result.

It turns out that, integrated via QEWD, Cache is an ideal bed-fellow for Node.js.  QEWD makes the integration of Cache and Node.js exceptionally fast, simple and intuitive to use, but also extremely powerful.

Read the article here: 

https://robtweed.wordpress.com/2017/04/18/having-your-node-js-cake-and-e...

If you're interested in using Cache with Node.js, you really need to take a look at QEWD!

Last comment 25 September 2017
+ 4   0 4
302

views

+ 4

rating

MonCaché — MongoDB API implementation based on InterSystems Caché

Disclaimer: This article reflects author's private opinion and has no relation to the official position of InterSystems.

IDEA

The idea of the project is to implement basic MongoDB (v2.4.9) API features for searching, saving, updating and deleting documents in a way that will allow the use of InterSystems Caché instead of MongoDB without changing the code on the client side

Last comment 13 September 2017
+ 9   0 8
1092

views

+ 9

rating

Hi,

I would like to draw your attention on a recently published article, titled "A Quick Guide on How to Prevail in the Graph Database Arena", that has been posted also at LinkedIn. Intersystems Caché has been referenced several times. In the "Multi-model Database Engine" section of this article, there is a quick description of Caché  as a

Last comment 11 September 2017
+ 2   0 2
595

views

+ 2

rating

a.k.a..  "The World of Widgets Returns!" or "Paternity leave damages Instructional Series momentum"

In our last lesson, we combined 2 separate classes to appear as the same property.  We now have the ability to Update our Widget catalog, but what if we want to Create a Widget?  Thankfully, we've already done 90% of what we need, just by implementing Edits

As we mentioned when creating the REST Services for PUT and POST, the only real difference between creating and updating a record is whether we are passing in an existing ID or creating a %New record.  The actual content of the Widget JSON is exactly the same, so this allows us to be a little lazy and reuse the form and controller code we have previously written, with just some minor edits to allow it to work for New Widget

0   0 1
0

comments

353

views

0

rating

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-

w outputObj.%data("test_test")

 

Regards,

Nael

Last answer 31 August 2017 Last comment 5 September 2017
0   0 2
225

views

0

rating

In my previous posting about the new support in QEWD for JSON Web Token (JWT) support, I mentioned that it was a key step in enabling Micro-Service support in QEWD.  In this post I'll give some background to how they work and the thinking behind them.

If you haven't heard about Micro-Services and/or want to learn more, there's lots of information available if you do a Google Search.  Here's a good starting point:

https://smartbear.com/learn/api-design/what-are-microservices/

Last comment 5 September 2017
+ 3   0 3
343

views

+ 3

rating

Cogs Library

Over the next few months I will be releasing a number of open source libraries and tools to the Caché community.

Most of the code has evolved from previous production grade solutions over the years and I am collating it together under a single overarching library package that I am calling Cogs.

Last comment 4 September 2017
+ 12   0 5
873

views

+ 12

rating

Good afternoon - 

I'm in the process of learning to make COS calls to REST-based web services and while I am having success, I'm struggling on how to parse out the results (I admit I'm very green at this):

Here's the code retrieving the JSON response:

w !,"Get the JSON"
Set Result = {}.%FromJSON(Request.HttpResponse.Data)

This has Result as a Library.DynamicObject.

I can then write out the response using

Last answer 30 August 2017 Last comment 30 August 2017
0   0 1
547

views

0

rating

Hello -- Is there a way to load a JSON from a file.

I have a "JSON" file which has a sting 1035164 long with the following format: 

[
    {
        "id": "12345",
        "title": "John Smith",
        "image_uri": "https://<some URL>",
        "image_timestamp": "1496781334",
        "image_url":"https://<some URL>",
        "is_restricted_under_18_only": false,
        "is_restricted_adult_only": false
    },
...
    {
        "id": "67890",
        "title": "Mary Jane",
        "image_uri": "https://<some URL>",
        "image_timestamp": "1496781334",
        "image_url": "https://<some URL>",
        "is_restricted_under_18_only": false,
        "is_restricted_adult_only": false
    }
]

There are ~ 4839 entries. 

Is it possible to parse a JSON string by loading a from a file?

I tried this..

Last answer 14 August 2017 Last comment 15 August 2017
0   0 3
824

views

0

rating

Developing a Full-Stack JavaScript web app with Caché requires you to bring together the right building blocks. Previously, I outlined the basic steps to install and connect Node.js to Caché and make it's powerful multi-model database capabilites available for use with Node.js. You can use Caché as a NoSQL-, document- (with unique key-level access!), SQL- and object-database with Node.js. When developing JavaScript applications, you'll see how powerful this combination is and makes Caché a perfect fit for Node.js.

In the first part of this article series I will show how to get started with the React framework, one of the most popular frameworks currently taking over front-end development. In the next parts you'll learn how to connect a basic web app to a Caché back-end.

You'll see, it's very easy to get started with this technology - you can even compare the amount of basic knowledge you need to COS because you only need to know a few basic concepts to start!

Last comment 8 August 2017
+ 8   1 14
3250

views

+ 8

rating

If you read my previous post that introduced QEWD Micro-Services, you're hopefully eager to learn how to use them.  So in this post I'll explain what you need to know in order to get started.

If you look in the QEWD repository, you'll find the folder: 

  https://github.com/robtweed/qewd/blob/master/example/jwt

In my earlier post on JSON Web Tokens (JWTs) and QEWD I used this example application to explain how to use JWTs.  This example application also demonstrates how to set up a simple Micro-Service, in this case a service that handles user authentication.  So let me now delve into that aspect of the example application.

If you're wanting to use QEWD Micro-Services, you must also use JWTs - these provide the means by which the user's authentication and session can be cross-communicated and handled by multiple, discrete QEWD servers.  So, take a look at the startup file

+ 1   0 2
0

comments

238

views

+ 1

rating

Hi All,

We have a application currently running on Zen framework, now business wants to use Angular JS as their front-end technology for any future release but they don't want to upgrade the existing the modules which are already there in Zen (as of now).

Last answer 25 July 2017 Last comment 27 June 2017
0   0 1
252

views

0

rating

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

Last answer 20 July 2017 Last comment 15 May 2017
0   0 1
1025

views

0

rating

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

Last answer 14 July 2017 Last comment 14 July 2017
0   0 4
225

views

0

rating

Hi.

It is easy to receive JSON representation or dynamic Array from %ListOfDataTypes:

set l=##class(%ListOfDataTypes).%New()
do l.Insert("a")
do l.Insert("b")
do l.Insert("c")

set arrStr=l.$toJSON()
zwrite arrStr
set arr=l.$compose([])
zwrite arr

How to make backward conversion? How to receive %ListOfDataTypes from dynamic Array an JSON string?

I've tried

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

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

and

SAMPLES>write arr.$compose(##class(%ListOfDataTypes).%New())
 
zcompose+44^%Library.AbstractObject.1 *%Exception.General Compose Compose %FromObject Unable to map from %Library.Array instance to %Library.ListOfDataTypes
Last answer 30 June 2017 Last comment 8 February 2016
+ 2   0 3
714

views

+ 2

rating

The Cogs.JsonClass library is now available in the Cogs project on GitHub.

https://github.com/SeanConnelly/Cogs

Please see the README and the /docs folder on how to use the class.

Overview

The Cogs.JsonClass class provides a one step serialisation and deserialisation to and from Caché registered and persistent classes. It is not dependent on any other code and should be compatible with older versions of Caché.

The unit tests have been included in the update, but until I release the dependent Touchstone unit test solution it won't be possible to run these tests.

Please report any issues on the GitHub issues log.

I will post some benchmarks later in the week.

Sean.

Last comment 8 June 2017
+ 5   0 6
458

views

+ 5

rating

Hi!

I have a question:

I create a Operation REST API , when I call to my client trough this REST API, my cliente returns list of object in JSON, like that:

[
    {
    "Center" : "aaaaaaaaaa",
    "Nif" : "00000000T",
    "NumberCenter" : "00000000",
    "Name" : "ppppp",
    },
    {
    "Center" : "aaaaaaaaaa",
    "Nif" : "00000000T",
    "NumberCenter" : "00000000",
    "Name" : "ppppp",
    },
    {
    "Center" : "aaaaaaaaaa",
    "Nif" : "00000000T",
    "NumberCenter" : "00000000",
    "Name" : "ppppp",
    }
]

On the other hand, I have in my Ensemble, Two class:

Class A --> lisf of class B

Class B --> Center, Nif,NumberCenter, Name

I need to iterate over JSON and capture de information a put this in my object A

I have been investigating... And I found a approximation that i want to do...

First of all, I want to iterate over JSON and capture de informatio

Last answer 1 June 2017 Last comment 2 June 2017
0   0 4
402

views

0

rating