search

Home  >  Q&A  >  body text

There are a lot of backslashes in the data stored in json format in Navicat for mysql. How to remove them?

When using mysql's json operation, it will be interfered by escape characters. It is normal to read it. I want to save it in the database without these backslashes

巴扎黑巴扎黑2775 days ago1501

reply all(3)I'll reply

  • 世界只因有你

    世界只因有你2017-06-06 09:54:07

    Visually, there is a problem with your storage. What you store is an array of strings, not an array of josn objects

    reply
    0
  • 某草草

    某草草2017-06-06 09:54:07

    Visually, it is related to the serialization library (or class) you are using. Let’s debug it with breakpoints before importing it into the library.

    reply
    0
  • ringa_lee

    ringa_lee2017-06-06 09:54:07

    Adding a backslash is for safety reasons, so it is best to add it. thinkphp's I method has data filtering. If you remove the filtering, there will be no backslashes.

    You can separate the json data and store it in different fields

    Or use serialize() to serialize the json data and store it, and then unserialize() it when taking it out

    reply
    0
  • Cancelreply