Remove json gem dependency

* Update Gemfile to use eval_gemfile
Extract code from conditional branch to perform everytime

* I am still not happy with this code and currently searching for a
  better algorithm.