I get this string "{"hitt":"","test":"1"}" and i want to convert it into array like ['hitt] = '', ['test'] = 1 kindly help me
Asked
Active
Viewed 32 times
1 Answers
0
Try using json_decode
$json = '{"hitt":"","test":"1"}';
$array = json_decode($json, true) //true to convert to array
var_dump($array)
Output:
array(2) {
["hitt"] => string("")
["test"] => string("1")
}
-
@bilalwaheedch upvote and accept if it helped please – Feb 27 '21 at 10:27
-
`$json = "{"hitt":"","test":"1"}";` from your example will cause a syntax error. – El_Vanja Feb 27 '21 at 10:50