Announcement

Collapse
No announcement yet.

sort JSON?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • wmgilligan
    replied
    Originally posted by Kent Multer View Post
    In case you don't know, I published a sorting function that's very efficient, versatile, and easy to use (no callback needed). You can see it at http://themagicm.com/store/a-new-miv...-function.html. Ray Yates of PCINet wrote a version with a couple of improvements. I'm not sure if he's published it on a Web page, but I can send you a copy if necessary.
    Thanks Kent,
    I did not know. I will check it out!

    Bill

    Leave a comment:


  • Kent Multer
    replied
    In case you don't know, I published a sorting function that's very efficient, versatile, and easy to use (no callback needed). You can see it at http://themagicm.com/store/a-new-miv...-function.html. Ray Yates of PCINet wrote a version with a couple of improvements. I'm not sure if he's published it on a Web page, but I can send you a copy if necessary.

    Leave a comment:


  • dcarver
    replied
    You can use miva_array_sort. You'll first have to decode the JSON data, then use miva_array_sort to define a custom sort callback function. Within that callback function you'll be able to sort the data based on name. You'll probably also have to call miva_array_sort for each user within the first miva_array_sort callback in order to sort the messages for that user as well.

    Leave a comment:


  • wmgilligan
    started a topic sort JSON?

    sort JSON?

    Is it possible using one of the available sort options to sort a json response?

    Example json:
    {"data":[{"name":"John","age":30,"car":null,"messages":[{"message1":"hello","message3":"out of order","message2":"goodbye"}]},{"name":"Allen","age":30,"car":null,"messages":[{"message1":"hello","message3":"out of order","message2":"goodbye"}]}]}

    I'd like to sort first on data[]:name
    and then on data[]:name:messages
Working...
X