Input and Json problems with quotation marks

Asked

Viewed 840 times

1

Hello. I’m developing a web application using Springfrontend and a Restful API in the backend. The front is in javascript taking data from the API. There was a problem....

When quoting a field in an Input or Textarea It breaks the code and returns 400.

If the JSON that picks up the inputs has quotes " " and enters the input ' for testing it returns the error. Unexpected Character ('"' (code 34)): was expecting comma to Separate OBJECT Entries at [Source: org.glassfish.jersey.message.Internal.Readerinterceptorexecutor$Uncloseableinput Stream@36f8cabd; line: 1, column: 26]

Here is the question. It is recommended to move all the places that I do the concatenation of JSON pro Ajax send to API. Or create a global function to remove double or single quotes from all input and textarea?

Remembering that my project is huge, more than 40 pages . view jsp and several in the API. What suggestions do you give me? Thank you, no guardo.

  • 1

    Would that be something like? http://answall.com/questions/41662/erro-ao-inserir-ap%C3%B3strofo-in-component-using-auto-complete

  • That’s right Marconi, sorry to answer now. The tricky thing is that I have several JSON in the project created from String concatenations. Now it’s time to spend a few hours adjusting and testing to make sure you don’t miss the mistake. In the current scenario I blocked the quotes in inputs and textareas with a function. Solved, however there are cases that quotes will be necessary for inclusion. Thank you for the post.

  • 1

    Glad I could help.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.