Leading zeros removed / missing from JSON

Leading zeros removed / missing from JSON

TronikTronik Posts: 120Questions: 27Answers: 1

Hi,

I've already checked previous threads regarding this matter, and I'm using Editor 2.0.5, I updated to 2.0.7 just to check but that didn't help.

This is the received data from server:

{"DT_RowId":"row_002518036003","variations":{"sku":2518036003,"barcode":7108458268706}

but is supposed to be:

{"DT_RowId":"row_002518036003","variations":{"sku":002518036003,"barcode":07108458268706}

Note the leading zeros in the sku and barcode fields.
as you can se the DT_RowId is received correctly, but not the data fields.

I've done troubleshooting for some hours now but I'm stuck. Don't understand this behaviour.

Can't see any problems with the serverside code:

Editor::inst( $db, 'variations', 'sku' )
    ->fields(
        Field::inst( 'variations.sku' ),
        Field::inst( 'variations.barcode' ),
        Field::inst( 'products.name' )      
    )
    ->leftJoin( 'products', 'products.id', '=', 'variations.parent_product' )
    ->where( function ( $q ) {
          $q->where( 'products.sales_location', "('B','W')", 'IN', false );
        } )
    ->process( $_POST )
    ->json();

Replies

  • TronikTronik Posts: 120Questions: 27Answers: 1

    Ok, I sorted it, I hadn't updated all lib files, now it works
    You can delete this :)

Sign In or Register to comment.