Home  >  Q&A  >  body text

mysql5.7 json数据类型存储 导致数据顺序发生变化

json字符串数据原先是使用text进行存储的,字典格式会保持原有的顺序。

但是该为json后,变失去了顺序性。

如何在json格式里保持?

天蓬老师天蓬老师2742 days ago870

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 16:17:38

    json is naturally unordered, just like js. For reference
    If you want to maintain the order when outputting, add a key-value pair to json"sort":"a,b,c", and loop according to the order of the sort value when outputting

    reply
    0
  • Cancelreply