json - PHP - Escaping doesn't work for me? -
i've been trying json in string, have escape double quotes.. here's line {\"assetid":".$assetid.", "floatvalue\":".$floatvalue.\"},
$data = [ 'assetid' => $assetid, 'floatvalue' => $floatvalue, ]; $result = json_encode( $data );
edited
foreach($floatdone['result']['items'] $data) { $assetid = $data['id']; $floatvalue = $data['attributes']['2']['float_value']; $swag[] = //your mistake, guess, use $swag[] instead of $swag [ 'assetid' => $assetid, 'floatvalue' => $floatvalue, ]; } var_dump( json_encode($swag) );
Comments
Post a Comment