writing json data into json array