PHP decode of JSON doesn't work from the Google translate API -


i'm trying decode json returned google translation service:

$r = '[[["hola mundo","hello world",,,1]],,"en"]' 

but when this:

echo json_decode($r); 

it returns me null.

i got manual maded js, trying made php

https://ctrlq.org/code/19909-google-translate-api

to clarify issue,

json string (and in php should quote encapsulated), in code, have not declared string array, , clear can instantiate array couple methods:

$myarray = array(); $myarray2 = []; 

so fix issue; encapsulate json string, replace echo json_decode($r) var_dump($r) , voila

eg

$r = '[[["hola mundo","hello world",,,1]],,"en"]'; var_dump(json_decode($r)); 

but not valid json syntax (check on http://jsonlint.com/)


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo