how to overwrite JSON data

how to overwrite JSON data

isicong@163.comisicong@163.com Posts: 3Questions: 2Answers: 0

on server side, there's a line of code

Editor::inst( $db, 'my_table', 'id' )

/// blah blah blah

->json(); //function to send back data

how can I edit the json data without alter values in datatabase?
I want to change the original json() function. but I keep getting syntax issues.

Answers

  • ztevieztevie Posts: 101Questions: 23Answers: 5
    edited June 2017

    Look at getValue and getFormatter, they are intended to use for the values you send to client.

  • allanallan Posts: 63,893Questions: 1Answers: 10,530 Site admin

    The ->json() method is basically:

    $data = $editor->data();
    echo json_encode( $data );
    

    You can use the Editor->data() method to get the data and manipulate it as you need, then echo it out as JSON yourself.

    Allan

This discussion has been closed.