AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Store two references to a json object in one parent object
 
 

Hi,

for my current project I need to store two references to a json object in one parent object.

In my version the objects are nested more deeply, but if the following would work somehow, I could make my scenario work, too:

$$objectinner = ^jsoncreate(permanent object)
 $
$objectinner.id objectinner

 
$$objectouter = ^jsoncreate(permanent object)
 $
$objectouter.innera = $$objectinner
 
$$objectouter.innerb = $$objectinner

 output 
^jsonwrite($$objectouter

which produces the following output:

Output { "innera": { "id": "objectinner"}, “innerb”: jo-0}

 

 

 
  [ # 1 ]

JSON per se does not allow multiple references. CS Json does, but will not print them both out because of the potential for an infinite loop in printing. If you need two references, you should do JSONCOPY on one of them

 

 
  login or register to react