From 6666a5f304b12944d6c782e3c5bd3c7174c1a2eb Mon Sep 17 00:00:00 2001 From: Ankit <20921930+Ankit-Laddha@users.noreply.github.com> Date: Mon, 8 Feb 2021 21:11:35 +0100 Subject: [PATCH] Update 05 data-parameterization.md Current code throws an error. It implies SharedArray can only contain/parse Arrays. Hence reading users property on the Object to return Array directly `ERRO[0000] GoError: only arrays can be made into SharedArray at apply (native)` --- .../05 Examples/01 Examples/05 data-parameterization.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/markdown/docs/05 Examples/01 Examples/05 data-parameterization.md b/src/data/markdown/docs/05 Examples/01 Examples/05 data-parameterization.md index 6021b45c6a..72b2f38d43 100644 --- a/src/data/markdown/docs/05 Examples/01 Examples/05 data-parameterization.md +++ b/src/data/markdown/docs/05 Examples/01 Examples/05 data-parameterization.md @@ -54,11 +54,11 @@ import { SharedArray } from "k6/data"; // not using SharedArray here will mean that the code in the function call (that is what loads and // parses the json) will be executed per each VU which also means that there will be a complete copy // per each VU -const data = new SharedArray("some data name", function() { return JSON.parse(open('./data.json')); }); +const data = new SharedArray("some data name", function() { return JSON.parse(open('./data.json')).users; }); export default function () { - let user = data.users[0]; - console.log(data.users[0].username); + let user = data[0]; + console.log(data[0].username); } ```