Jump to content

Varying timestamp formats in JSON packet, and parse json loose


Sharad Honavar

Recommended Posts

Hello,

For Tibco Streambase 10.6

 

e.g. {"date1":"2022-03-03T05:00:00", "date2":"2004-11-01 05:12:00", "myarr":[1,2,3]}, so I only look at myarr , but it will skip the whole record even if Loose parsing is on. And I can only set the timestamp format one way or the other.

I am using the JSON-TO-TUPLE global Operator to parse a complex json strutcure with multiply nested arrays, then passing it through 2 sequential Iterator operators to split nested arrays. There's also lots of non-Array field/values in the json input I dont need and dont even include them in the each.element....of the iterator output sent downstream. I have checked the "Enable Loose Parsing" checkbox

Among the un-needed fields are dates with two different ISO8601 Date formatsyyyy-MM-dd'T'HH:mm:ss ANDyyyy-MM-dd HH:mm:ss. (without the T seperator) But I can set the timestamp format for the adapter only one of the two ways. So if I set it one way, say without the 'T Date/time seperated fields, it fails on those T seperated dates with "Unable to parse time 2023-02-15T00:00:00", but if I set it with the T seperator, the T Dates succeed and fails on non-T's.

In my case, I don't even need the dates downstream and wouldn't have been a problem if the "Enable Loose Parsing" just ignored the fields (as the doc says it does) But it SKIPS the record. which I don't want it to, since I look at the nested array elements which has no dates.

As a another post with with json parser using the expression catchexception(parsejson_loose... and catching the exception may not work because I want to still pass on the successfully parsed part of the json packet.

What are my options

 

 

Thank You

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...