Hi @huligesh.hanumanthap !
Adding to the @PaulM 's response, you can use the following approach:
import http from 'k6/http';
export default function () {
const res = http.get('https://test-api.k6.io/public/crocodiles/');
let obj = res.json();
console.log(JSON.stringify(obj));
for (let index = 0; index < obj.length; index++) {
obj[index]["LOREM"] = [];
}
console.log(JSON.stringify(obj));
}
The output will look like this:
INFO[0001] [{"date_of_birth":"2010-06-27","age":11,"id":1,"name":"Bert","sex":"M"},{"name":"Ed","sex":"M","date_of_birth":"1995-02-27","age":27,"id":2},{"age":37,"id":3,"name":"Lyle the Crocodile","sex":"M","date_of_birth":"1985-03-03"},{"date_of_birth":"1993-12-25","age":28,"id":4,"name":"Solomon","sex":"M"},{"id":5,"name":"The gharial","sex":"F","date_of_birth":"2004-06-28","age":17},{"name":"Sang Buaya","sex":"F","date_of_birth":"2006-01-28","age":16,"id":6},{"date_of_birth":"1854-09-02","age":167,"id":7,"name":"Sobek","sex":"F"},{"sex":"M","date_of_birth":"1981-01-03","age":41,"id":8,"name":"Curious George"}] source=console
INFO[0001] [{"LOREM":[],"id":1,"name":"Bert","sex":"M","date_of_birth":"2010-06-27","age":11},{"sex":"M","date_of_birth":"1995-02-27","age":27,"LOREM":[],"id":2,"name":"Ed"},{"id":3,"name":"Lyle the Crocodile","sex":"M","date_of_birth":"1985-03-03","age":37,"LOREM":[]},{"name":"Solomon","sex":"M","date_of_birth":"1993-12-25","age":28,"LOREM":[],"id":4},{"id":5,"name":"The gharial","sex":"F","date_of_birth":"2004-06-28","age":17,"LOREM":[]},{"name":"Sang Buaya","sex":"F","date_of_birth":"2006-01-28","age":16,"LOREM":[],"id":6},{"sex":"F","date_of_birth":"1854-09-02","age":167,"LOREM":[],"id":7,"name":"Sobek"},{"sex":"M","date_of_birth":"1981-01-03","age":41,"LOREM":[],"id":8,"name":"Curious George"}] source=console
Hope that helps,
Cheers