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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -