JSON Parse Error Help.

Home Forums MapPress Support JSON Parse Error Help.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #15044
    edan
    Participant

    I’ve implemented Mappress and it is working well on my site. However I now want to try and query the wp_mappress_maps table and [obj] field and access using JSON editor e.g. http://www.jsoneditoronline.org/

    However, I keep getting:
    ++++
    Error: Parse error on line 1:
    {s:5:”mapid”;s:1:”4″;
    -^
    Expecting ‘STRING’, ‘}’, got ‘undefined’
    +++

    Has anyone else had trouble accessing the [obj] field with JSON?

    #15046
    edan
    Participant

    The full field value is:

    O:12:”Mappress_Map”:9:{s:5:”mapid”;s:1:”4″;s:5:”width”;s:3:”250″;s:6:”height”;s:3:”140″;s:4:”zoom”;i:15;s:6:”center”;a:2:{s:3:”lat”;d:-23.7617982000000012021700968034565448760986328125;s:3:”lng”;d:133.87464520000003176392056047916412353515625;}s:9:”mapTypeId”;s:7:”roadmap”;s:5:”title”;s:39:”LOCATION NAME”;s:7:”metaKey”;N;s:4:”pois”;a:1:{i:0;O:12:”Mappress_Poi”:10:{s:7:”address”;N;s:4:”body”;s:13:”<p> </p>”;s:16:”correctedAddress”;N;s:6:”iconid”;N;s:5:”point”;a:2:{s:3:”lat”;d:-23.7617982000000012021700968034565448760986328125;s:3:”lng”;d:133.87464520000003176392056047916412353515625;}s:4:”poly”;N;s:3:”kml”;N;s:5:”title”;s:39:”LOCATION NAME”;s:4:”type”;N;s:8:”viewport”;N;}}}

    #15053
    Chris
    Keymaster

    Hi,

    The reason for the error is that the data is actually PHP serialized objects – not JSON. You can retrieve it using the functions in file ‘mappress_map.php’, or using the PHP unserialize() function:
    http://php.net/manual/en/function.unserialize.php

    #15057
    edan
    Participant

    Thanks Chris. I’ll look into what is possible with that approach.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.