LoginSignup
2
2

More than 5 years have passed since last update.

JSON::ParserError: 399: unexpected token at って出たけど・・・

Posted at

サンプルとしてもらった少し大きめのJSONファイル。
rake taskからファイルの中身を読み込もうと思ったら・・・

      @json_data = open('tmp/sansan/api_sansan_result.json') do |io|
        JSON.load(io)
      end
$ rake sansan:import
rake aborted!
JSON::ParserError: 399: unexpected token at '{
            "building": null,
            "city": "新宿区",

どこかにエラーがあるらしい・・・

探すのめんどいって思っていたらいい記事がありました
気軽にjsonのsyntax checkを行う
ありがとうございます!

自分ので特に何もいじってないVM環境(CentOS)内でpythonって動くのかなぁと思いつつ試してみたところ

$ cat tmp/sansan/api_sansan_result.json | python -mjson.tool
Invalid control character at: line 6 column 49 (char 144)

こんな感じでエラー個所を教えてくれました。
1つずつエラーをつぶしていって無事解決!

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2