ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexWebSphere Message Broker (ACE) SupportJSON datatypes - parser details

Post new topicReply to topic
JSON datatypes - parser details View previous topic :: View next topic
Author Message
MrSmith
PostPosted: Thu Mar 11, 2021 1:08 pm Post subject: JSON datatypes - parser details Reply with quote

Master

Joined: 20 Mar 2008
Posts: 215

Hi

ACE 11.0.0.9

Incoming request - JSON parser, validate content and value set.
If you were to set say a json defined element as decimal and send in 99.t45 it quite rightly fails the parsing
If you send in "999.88" then the parser allows that to go as it would appear that it does not check the data type (character obviously) against the json.
This you can CAST etc but I am looking to know if there is any way of being able to access what the parser has set that too, aka if i debug this in the toolkit and look in the message tree it will say my value is CHARACTER: 999.88, what i want to ba able to do is throw and error on this cos i know it should have been a Number as defined in the json
FIELDTYPE is not relevant as this lonly tells you if it is a type of Field or element or whatever, not what its datatype is

I could go down the path of DFDL but dont at this point really want to apply a "schema" of sorts to this

Any thoughts welcome
TIA
_________________
-------- *
“Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.”
Back to top
View user's profile Send private message
timber
PostPosted: Fri Mar 12, 2021 6:57 am Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Not sure if this is what you meant, but you definitely do not want to parse JSON using DFDL!

What you really need is JSON validation, but ACE does not have that yet. Do you really need this check? Are clients of this API really going to supply a string instead of a decimal in this named field? If they do, will it actually be dangerous to auto-cast that string to a decimal?
Back to top
View user's profile Send private message
MrSmith
PostPosted: Thu Mar 18, 2021 4:56 am Post subject: Reply with quote

Master

Joined: 20 Mar 2008
Posts: 215

timber

First thanks for the reply.

No ideally i would like the parser to sort this for me or perhaps even a "new" ESQL function that will pass back the actual datatype as would be equiv to typeof in other languages.

You say ACE doesn't have that YET, is there a [plan for it then? and if so any guess on when that is likely to be?

In truth I have managed to get around the situation by a mixture of declaring a handler and casting, but for this instance the testers fail the code because it starts with a double quotes denoting string when the yaml defines say decimal and therefore it fails even though the output is rectified to the proper datatype.

any insider info on the above would be greatly appreciated.
_________________
-------- *
“Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.”
Back to top
View user's profile Send private message
timber
PostPosted: Thu Mar 18, 2021 9:28 am Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Quote:
In truth I have managed to get around the situation by a mixture of declaring a handler and casting, but for this instance the testers fail the code because it starts with a double quotes denoting string when the yaml defines say decimal and therefore it fails even though the output is rectified to the proper datatype.
You cannot do better than that using native ACE facilities. If you really require JSON validation then I recommend a JavaCompute node with a 3rd party validating JSON parser.
Quote:
any insider info on the above would be greatly appreciated
Sorry, not an insider these days
Back to top
View user's profile Send private message
MrSmith
PostPosted: Fri Mar 19, 2021 2:10 am Post subject: Reply with quote

Master

Joined: 20 Mar 2008
Posts: 215

nice one timber and yes might be an option - call out to java or JCN

Thanks
_________________
-------- *
“Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.”
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker (ACE) SupportJSON datatypes - parser details
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.