We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42655
    • 5 Posts
    I have a database field with JSON arrays in it and when I read it only the first value is retrieved.
    The map.inc.php section looks like this
    'config' =>
    array (
    'dbtype' => 'text',
    'phptype' => 'json',
    'null' => false,
    'default' => '',
    )
    and the data stored in this field is a simple JSON array like this:
    ["value1","value2","value3"]
    I access the field this way:
    $object->get('config')
    and this returns an array with one entry max.

    Can anybody help me with this?

    This question has been answered by Bruno17. See the first response.

    • discuss.answer
      • 4172
      • 5,888 Posts
      this is working for me.
      with

      if ($object = $modx->getObject('myGallery',13)){
          $ext = $object->get('extended');
      }
      
      print_r($ext);
      


      I get

      Array ( [0] => value1 [1] => value2 [2] => value3 )
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 42655
        • 5 Posts
        Thanks Bruno17

        the $modx->getObject did the trick