Skip to content

Instantly share code, notes, and snippets.

@aboglioli
Created February 16, 2017 23:58
Show Gist options
  • Save aboglioli/0e24b06e6f5a6fa68c22e8dba33aa509 to your computer and use it in GitHub Desktop.
Save aboglioli/0e24b06e6f5a6fa68c22e8dba33aa509 to your computer and use it in GitHub Desktop.
PHP Array to JSON
<?php
$datos = [
"title"=> "Property title",
"category_id"=> "MLU1468",
"price"=> 100000,
"currency_id"=> "UYU",
"available_quantity"=> 1,
"buying_mode"=> "classified",
"listing_type_id"=> "silver",
"condition"=> "not_specified",
"pictures"=> [
[ "source" => "http=>//mla-d2-p.mlstatic.com/item-de-test-no-ofertar-543605-MLA25041518406_092016-O.jpg?square=false" ]
],
"seller_contact" => [
"contact"=> "Contact name",
"other_info"=> "Additional contact info",
"area_code"=> "011",
"phone"=> "4444-5555",
"area_code2"=> "",
"phone2"=> "",
"email"=> "contact-email@somedomain.com",
"webmail"=> ""
],
"location"=> [
"address_line"=> "My property address 1234",
"zip_code"=> "01234567",
"neighborhood"=> [
"id"=> "TUxBQlBBUzgyNjBa"
],
"latitude"=> -34.48755,
"longitude"=> -58.56987
],
"attributes"=> [
[ "id"=> "MLU1466-AMBIENTES", "value_name"=> "2" ]
],
"description"=> "This is the real estate property descritpion."
];
print json_encode($datos);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment