Bug in Data Server Data Type identification on null object properties

Justin Tilson asked on January 19, 2023

I'm setting up a proof of concept to make sure your product will work for a project my team is implementing. I just ran into a problem setting up an index with your data server when loading a local JSON file. Below is a sample that illustrates the problem:

"projectName": "Somewhere in San Antonio",
"projectAddressCity": "San Antonio",
"projectAddressStreetNumber": "10500",
"projectAddressStreetName": "SeaWorld Dr.",
"projectCreatedBy": "Bob the Builder",
"projectCreatedAt": 1673876055523,
"projectUpdatedBy": null,
"projectUpdatedAt": null,
"projectName": "121 Residential Thing",
"projectAddressCity": "Austin",
"projectAddressStreetNumber": "123",
"projectAddressStreetName": "Lamar Blvd.",
"projectCreatedBy": "Blob the Builder",
"projectCreatedAt": 1664079340869,
"projectUpdatedBy": "Some Admin Guy",
"projectUpdatedAt": 1673962641577

The error I was getting was: Index _____ cannot be loaded. Details: Cannot load data from JSON file at ".../sample-data/data.json". Please check file format. The requested operation requires an element of type 'String', but the target element has type 'Number'.
The problem is that the very first record has a null value for the projectUpdatedAt property (a timestamp).
Your data server assumes this property is a string. When the second record is parsed, it fails with the error above. If I supply a numeric value for the first record's projectUpdatedAt the problem goes away.
Is there some way to feed a JSON schema document to your data server so it knows what to expect so it does't have to guess the data type of a null value?
It was somewhat challenging to sort out what was going wrong because your error message was relatively generic and didn't identify the field that was causing the problem.
If it matters, I'm running on a Mac with Apple Silicon.

5 answers

Solomiia Andrusiv Solomiia Andrusiv Flexmonster January 20, 2023

Hello, Justin!
Thank you for contacting us.
Kindly note that in Flexmonster, data types are automatically defined using the values from the first object of JSON data.
Keeping this in mind, we kindly suggest avoiding null data in the first JSON object.
Hope you will find our answer helpful.
Feel free to contact us in any other questions arise.

Justin Tilson January 20, 2023

Thank-you for the follow up Solomiia. That's not the answer I was hoping for as I have to deal with whatever data flows my way. I'll have come up with a way to ensure the first record is a complete one even though that's not how our system works.
Perhaps you could pass along the suggestion to your development team that having the ability to pair a json schema document with a data server index would be the most reliable and straight forward way to solve this particular problem.

Solomiia Andrusiv Solomiia Andrusiv Flexmonster January 20, 2023

Hello again, Justin!
Thank you for getting back to us.
We understand that the described parsing behavior has an impact on your user experience.
We have already discussed the described case with our development team and will provide a fix with the ETA February 6th.
In addition to that, we already have in our customers' wishlist the task of adding a JSON schema when loading files in Flexmonster Data Server. We have noted that your company is interested in mentioned feature and will notify you about any updates on the matter.
Our team will notify you when the fix is ready.
You are welcome to use the workaround mentioned in the previous message till the fix is ready.
Feel free to contact us in case of any other questions.

Justin Tilson January 20, 2023

Thx for the update Solomiia. A+ for rockstar support. Your responses have definitely been affirming for me as a buyer. Much appreciated.

Solomiia Andrusiv Solomiia Andrusiv Flexmonster January 23, 2023

Hello, Justin!

Thank you for your kind words.

Our team will notify you as soon as the fix is ready.

Do not hesitate to contact us if any other questions arise.

Kind regards,

Please login or Register to Submit Answer