changed building json from associative array in php
changed indexing for elements from