ang-jsoneditor icon indicating copy to clipboard operation
ang-jsoneditor copied to clipboard

Modify the JsonEditorOptions to prevent type validation?

Open bluelbow opened this issue 5 years ago • 6 comments

Is there a way to modify the JsonEditorOptions to prevent type validation? I would like the editor to treat the "value" only as string, is it possible? The editor interprets a string value that is starting by "0" as a number and prevent me from having a leading 0.

Thanks for your help and for the Editor! It's appreciated.

bluelbow avatar Feb 26 '20 15:02 bluelbow

What you mean? can u give one example?

mariohmol avatar May 06 '20 22:05 mariohmol

Hi, I encountered 2 situations.

  1. I have a filed called "TIMESTAMP" and it is a date in a string format. I would be happy if all the field were interpreted as string. But it is validated as a date, but the date doesn't fit (see screenshot) date_error.
  2. We have a field that looks like this 412340, However, to us, it's as string. So when we try to add a leading 0, it doesn't take it.

In short, I wanted to know if it would be possible for all the field to be interpret as strings.

Thanks.

bluelbow avatar May 07 '20 14:05 bluelbow

I see... I think that's an issue that it's related to the jsoneditor

Maybe this docs can help you, like setting a schema to your editor

https://github.com/josdejong/jsoneditor/blob/master/examples/07_json_schema_validation.html

mariohmol avatar May 07 '20 23:05 mariohmol

This might help you https://github.com/mariohmol/ang-jsoneditor/issues/63#issuecomment-613806162

mariohmol avatar May 07 '20 23:05 mariohmol

Thank you. I will try it.

bluelbow avatar May 08 '20 21:05 bluelbow

cool.. if doesnt work u can reopen

mariohmol avatar May 08 '20 21:05 mariohmol