My Flutter/Dart todo application has a Data table named TodoEntry with six columns: the ‘todos’ column is type json, four are string, one is datetime.
The data being stored is {username: jaustin@gmail.com, todos: {0: {title: milk, done: 0, created: 1638896985707}}, created: null, updated: null, objectId: null}, but Backendless sends back the error “PlatformException(8023, Validation for the ‘todos’ property failed. Property value does not match the required pattern., Validation for the ‘todos’ property failed. Property value does not match the required pattern., null)”.
The json column seems to be causing the error (“‘todos’ property failed”); if I change the todos column type to text the save works, although nothing shows in the todos column. The todos data {0: {title: milk, done: 0, created: 1638896985707}} shows as valid in an online json validator.
If I manually enter the json string through Multi Line Editor, it gives the message “Must be a valid JSON string!”!
I just tried the latter version and it worked just fine. The reason being is the JSON key identifiers must be string literals. Here’s a SO discussion on this sibject:
Thanks Mark, you’ve pointed me in the right direction. I (now) see the online json validator added the quotes to the keys and warned me; I just missed it.
The ‘correct’ line is still showing error: in my TodoEntry table the value
{“0”: {“title”: “milk”, “done”: 0, “created”: 1638896985707}} still causes Multi Line Editor to return
“Validation for the ‘todos’ property failed. Property value does not match the required pattern.”
If this is a known correct format for Backendless json validation, I’m wondering if the TodoEntry table has become corrupted. Should I delete and rebuild?
Jim
Mark,
Yes, that’s where I’m getting the error: I simply copy/paste the json string you sent into the todos column in the console. No coding involved … think it’s time to delete the table and rebuild?
Jim
I removed the todos column and recreated it in the table. There was something wrong with the column. Was it originally created as a JSON column or you converted it from another data type?
Then I tried copy/pasting the JSON from this forum and there is a problem with the quotes:
Thanks Mark, think that got it!! I was able to save a todo … looks like just after you did.
Yes, when couldn’t get the json type to save, tried text type, thinking I’d see the json string. Code did the save (username. etc.) but the todos column was empty. Went back and forth several times, so assumed that caused the problem. Just did another save (three items) and they all seem to be there.
Really appreciate your help … this one had me stumped!
Jim
Just before that is a sequence using SQLite (28-32), and I understand he’s working on a sequence using Firebase as the BaaS. The important thing (to me) is all three sequences use the same UI and are the ‘same’ app: a todo list that users register/log into and create, use, and delete todo items: a unique chance to compare the (Dart/Flutter) code for the same application using different authentication/storage methods.
Johan is hands-down the best teacher I’ve found in the on-line tutorial world. A number of years teaching at the university (UF) graduate level have left me with a lot of opinions about what’s good teaching and what’s not … there’s a lot of the latter out there in ‘Tutorial Hell!’
on a personal level, I’ve done several tutorial apps using Firebase, and am impressed by the smooth, straight-forward feel of the Backendless development process. Going to try to get to as many of the Missions as I can before the trial runs out.