Answer the question
In order to leave comments, you need to log in
Add style to javascript variable?
Hello!
Need help with the following question... there is a javascript timer
codepen.io/juniorCh/pen/GJxQdY
How do I add a class or style to variables to style this timer nicely?
There is not much js knowledge and experience yet. Can someone please tell me how to do this with jQuery?
I would be grateful for any help)
Answer the question
In order to leave comments, you need to log in
json_encode( $array / $object );
$result = json_decode( $string );
$result = (array)$result;
// read further on how to work with an array (enumerating, mapping, sorting, etc.)
JSON is simply a format for storing an array of information. In any case, the most you can do with JSON is to convert it to an array that the language works with. All other tasks for sorting and obtaining information are already done directly with the resulting array. Just loop through the array to get the data you need into your array:
$json = json_decode($items, true);
$i = 0;
foreach ($json as $data) {
$input_data_array[$i]['dow_file'] = $data['meta_data'][1]['value'];
$input_data_array[$i]['obj_name'] = $data['meta_data'][2]['value'];
$input_data_array[$i]['obj_flat'] = $data['meta_data'][3]['value'];
$input_data_array[$i]['obj_kad'] = $data['meta_data'][4]['value'];
/* и так далее.. */
$i++;
}
print_r($input_data_array);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question