Wednesday, February 13, 2013

Create a big JSON file for test purposes

Sometimes you need to try your parser with huge files either for performance reasons or to find out its limitations. Talend tFileInputJSON has a bug in version 5 as stated in this post.

Any script will do the trick here. Here is a quick bash to generate such big json file:
generateBigJson.sh
#!/bin/bash
#generateBigJson.sh

MAX=15000
echo "{\"arr\":["
i=1
while [ $i -le $MAX ]; do
  echo -ne "{\"id\":$i, \"next\":$((i+1))}"
  if [ "$i" -ne "$MAX" ]; then
    echo ","
  fi
  let i=i+1
done
echo "]}"

No comments:

Followers