working on json instead of array