web stats
CCDA-JSON error - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 08-06-2015, 01:55 AM
vibinChander vibinChander is offline
OBX.2 Kenobi
 
Join Date: Jul 2015
Location: Chennai
Posts: 74
vibinChander is on a distinguished road
Send a message via Skype™ to vibinChander
Default CCDA-JSON error

I'm trying to parse CCDA to JSON without using MDHT libraries I'm facing an error in structure of JSON this is my code.

if(msg['templateId'][0]['@root'].length()!=0 && msg['templateId'][0]['@root']=="2.16.840.1.113883.10.20.22.1.1")
{
var obj1={"Demographics":
{"date":msg['effectiveTime']['@value'].toString()},
{"title":msg['title'].toString()},
{"author":{
"name":{
"prefix":msg['author']['assignedAuthor']['assignedPerson']['name']['prefix'].toString()},
{"given":msg['author']['assignedAuthor']['assignedPerson']['name']['given'].toString()},
{"family":msg['author']['assignedAuthor']['assignedPerson']['name']['family'].toString()},
{"address":[
"street":msg['author']['assignedAuthor']['addr']['streetAddressLine'].toString()],
{"city":msg['author']['assignedAuthor']['addr']['city'].toString()},
{"state":msg['author']['assignedAuthor']['addr']['state'].toString()},
{"postalcode":msg['author']['assignedAuthor']['addr']['postalCode'].toString()},
{"country":msg['author']['assignedAuthor']['addr']['country'].toString()},
}

}
}
}
}
var ob1= JSON.stringify(obj1);
logger.info(ob1);


Im getting the error in "Error on line 5: invalid property id" could anyone help me findout the problem?
Reply With Quote
  #2  
Old 08-06-2015, 06:36 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,119
narupley is on a distinguished road
Default

You're creating that object incorrectly. Each property of an object needs to be given a proper ID. You're doing that correctly for "Demographics", but almost everything else after that is incorrect. Go here to learn about what JSON is and how it's used: http://json.org/. Although technically what you're creating is a JavaScript Object, not JSON, it will still help.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
Reply

Tags
ccda, json, mirth 3.2.0

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 07:56 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation