Skip to content

Instantly share code, notes, and snippets.

@pasberth
Created March 8, 2014 16:15
Show Gist options
  • Save pasberth/9434251 to your computer and use it in GitHub Desktop.
Save pasberth/9434251 to your computer and use it in GitHub Desktop.
WITH BOM:
757: unexpected token at '{"api_result":1,"api_result_msg":"\u6210\u529f","api_data":[{"api_id":9,"api_maparea_id":2,"api_name":"\u30bf\u30f3\u30ab\u30fc\u8b77\u885b\u4efb\u52d9","api_details":"\u6cb9\u7530\u5730\u5e2f\u304b\u3089\u71c3\u6599\u3092\u6e80\u8f09\u3057\u3066\u623b\u308b\u30bf\u30f3\u30ab\u30fc\u8239\u56e3\u3092\u8b77\u885b\u3057\u3088\u3046\uff01","api_time":240,"api_difficulty":3,"api_use_fuel":0.5,"api_use_bull":0,"api_active":1,"api_state":2,"api_win_item1":[10,1],"api_win_item2":[1,2]},{"api_id":10,"api_maparea_id":2,"api_name":"\u5f37\u884c\u5075\u5bdf\u4efb\u52d9","api_details":"\u6c34\u4e0a\u5075\u5bdf\u6a5f\u642d\u8f09\u8266\u306a\u3069\u3092\u6d3b\u7528\u3057\u3001\u6575\u8266\u968a\u306e\u52d5\u5411\u3092\u63a2\u308c\uff01","api_time":90,"api_difficulty":3,"api_use_fuel":0.3,"api_use_bull":0,"api_active":1,"api_state":2,"api_win_item1":[1,1],"api_win_item2":[2,1]},{"api_id":11,"api_maparea_id":2,"api_name":"\u30dc\u30fc\u30ad\u30b5\u30a4\u30c8\u8f38\u9001\u4efb\u52d9","api_details":"\u8cc7\u6e90\u96c6\u7a4d\u5730\u304b\u3089\u6bcd\u6e2f\u306b\u3001\u30dc\u30fc\u30ad\u30b5\u30a4\u30c8\u3092\u8f38\u9001\u3057\u3088\u3046\uff01","api_time":300,"api_difficulty":4,"api_use_fuel":0.5,"api_use_bull":0,"api_active":1,"api_state":2,"api_win_item1":[10,1],"api_win_item2":[1,1]},{"api_id":12,"api_maparea_id":2,"api_name":"\u8cc7\u6e90\u8f38\u9001\u4efb\u52d9","api_details":"\u8cc7\u6e90\u56fd\u304b\u3089\u8f38\u5165\u3055\u308c\u308b\u8cc7\u6e90\u3092\u6bcd\u6e2f\u3078\u8b77\u885b\u3057\u3001\u7121\u4e8b\u8f38\u9001\u3092\u5b8c\u4e86\u3057\u3088\u3046\uff01","api_time":480,"api_difficulty":4,"api_use_fuel":0.5,"api_use_bull":0,"api_active":1,"api_state":2,"api_win_item1":[11,1],"api_win_item2":[3,1]},{"api_id":13,"api_maparea_id":2,"api_name":"\u9f20\u8f38\u9001\u4f5c\u6226","api_details":"\u5feb\u901f\u306e\u99c6\u9010\u8266\u3092\u96c6\u4e2d\u904b\u7528\u3057\u3066\u3001\u6fc0\u6226\u306e\u8af8\u5cf6\u3078\u7269\u8cc7\u3092\u8f38\u9001\u3057\u3088\u3046\uff01","api_time":240,"api_difficulty":5,"api_use_fuel":0.5,"api_use_bull":0.4,"api_active":1,"api_state":2,"api_win_item1":[1,2],"api_win_item2":[10,1]},{"api_id":14,"api_maparea_id":2,"api_name":"\u5305\u56f2\u9678\u6226\u968a\u64a4\u53ce\u4f5c\u6226","api_details":"\u6a5f\u52d5\u529b\u306e\u3042\u308b\u5c0f\u8266\u8247\u90e8\u968a\u3092\u7d50\u96c6\u3057\u3001\u5305\u56f2\u4e0b\u306e\u90e8\u968a\u3092\u53ce\u5bb9\u3057\u3088\u3046\uff01","api_time":360,"api_difficulty":5,"api_use_fuel":0.5,"api_use_bull":0,"api_active":1,"api_state":2,"api_win_item1":[1,1],"api_win_item2":[3,1]},{"api_id":15,"api_maparea_id":2,"api_name":"\u56ee\u6a5f\u52d5\u90e8\u968a\u652f\u63f4\u4f5c\u6226","api_details":"\u6575\u6a5f\u52d5\u90e8\u968a\u306e\u6226\u529b\u3092\u8a98\u5f15\u3059\u308b\u7a7a\u6bcd\u3092\u542b\u3080\u56ee\u90e8\u968a\u3067\u3001\u4e3b\u529b\u8266\u968a\u3092\u652f\u63f4\u3057\u3088\u3046\uff01","api_time":720,"api_difficulty":6,"api_use_fuel":0.5,"api_use_bull":0.4,"api_active":1,"api_state":2,"api_win_item1":[12,1],"api_win_item2":[3,1]},{"api_id":16,"api_maparea_id":2,"api_name":"\u8266\u968a\u6c7a\u6226\u63f4\u8b77\u4f5c\u6226","api_details":"\u6709\u529b\u306a\u8266\u968a\u3092\u7de8\u6210\u3057\u3001\u6575\u306e\u80cc\u5f8c\u5074\u9762\u3092\u5947\u8972\u3001\u4e3b\u529b\u306e\u8266\u968a\u6c7a\u6226\u3092\u63f4\u8b77\u3057\u3088\u3046\uff01","api_time":900,"api_difficulty":6,"api_use_fuel":0.5,"api_use_bull":0.4,"api_active":1,"api_state":2,"api_win_item1":[2,2],"api_win_item2":[3,2]}]}
'
WITHOUT BOM:
{"api_result"=>1, "api_result_msg"=>"成功", "api_data"=>[{"api_id"=>9, "api_maparea_id"=>2, "api_name"=>"タンカー護衛任務", "api_details"=>"油田地帯から燃料を満載して戻るタンカー船団を護衛しよう!", "api_time"=>240, "api_difficulty"=>3, "api_use_fuel"=>0.5, "api_use_bull"=>0, "api_active"=>1, "api_state"=>2, "api_win_item1"=>[10, 1], "api_win_item2"=>[1, 2]}, {"api_id"=>10, "api_maparea_id"=>2, "api_name"=>"強行偵察任務", "api_details"=>"水上偵察機搭載艦などを活用し、敵艦隊の動向を探れ!", "api_time"=>90, "api_difficulty"=>3, "api_use_fuel"=>0.3, "api_use_bull"=>0, "api_active"=>1, "api_state"=>2, "api_win_item1"=>[1, 1], "api_win_item2"=>[2, 1]}, {"api_id"=>11, "api_maparea_id"=>2, "api_name"=>"ボーキサイト輸送任務", "api_details"=>"資源集積地から母港に、ボーキサイトを輸送しよう!", "api_time"=>300, "api_difficulty"=>4, "api_use_fuel"=>0.5, "api_use_bull"=>0, "api_active"=>1, "api_state"=>2, "api_win_item1"=>[10, 1], "api_win_item2"=>[1, 1]}, {"api_id"=>12, "api_maparea_id"=>2, "api_name"=>"資源輸送任務", "api_details"=>"資源国から輸入される資源を母港へ護衛し、無事輸送を完了しよう!", "api_time"=>480, "api_difficulty"=>4, "api_use_fuel"=>0.5, "api_use_bull"=>0, "api_active"=>1, "api_state"=>2, "api_win_item1"=>[11, 1], "api_win_item2"=>[3, 1]}, {"api_id"=>13, "api_maparea_id"=>2, "api_name"=>"鼠輸送作戦", "api_details"=>"快速の駆逐艦を集中運用して、激戦の諸島へ物資を輸送しよう!", "api_time"=>240, "api_difficulty"=>5, "api_use_fuel"=>0.5, "api_use_bull"=>0.4, "api_active"=>1, "api_state"=>2, "api_win_item1"=>[1, 2], "api_win_item2"=>[10, 1]}, {"api_id"=>14, "api_maparea_id"=>2, "api_name"=>"包囲陸戦隊撤収作戦", "api_details"=>"機動力のある小艦艇部隊を結集し、包囲下の部隊を収容しよう!", "api_time"=>360, "api_difficulty"=>5, "api_use_fuel"=>0.5, "api_use_bull"=>0, "api_active"=>1, "api_state"=>2, "api_win_item1"=>[1, 1], "api_win_item2"=>[3, 1]}, {"api_id"=>15, "api_maparea_id"=>2, "api_name"=>"囮機動部隊支援作戦", "api_details"=>"敵機動部隊の戦力を誘引する空母を含む囮部隊で、主力艦隊を支援しよう!", "api_time"=>720, "api_difficulty"=>6, "api_use_fuel"=>0.5, "api_use_bull"=>0.4, "api_active"=>1, "api_state"=>2, "api_win_item1"=>[12, 1], "api_win_item2"=>[3, 1]}, {"api_id"=>16, "api_maparea_id"=>2, "api_name"=>"艦隊決戦援護作戦", "api_details"=>"有力な艦隊を編成し、敵の背後側面を奇襲、主力の艦隊決戦を援護しよう!", "api_time"=>900, "api_difficulty"=>6, "api_use_fuel"=>0.5, "api_use_bull"=>0.4, "api_active"=>1, "api_state"=>2, "api_win_item1"=>[2, 2], "api_win_item2"=>[3, 2]}]}
require "json"
puts "WITH BOM:"
p JSON.parse(File.read("test.txt")) rescue puts $!
puts "WITHOUT BOM:"
p JSON.parse(File.read("test.txt")[1..-1])
{"api_result":1,"api_result_msg":"\u6210\u529f","api_data":[{"api_id":9,"api_maparea_id":2,"api_name":"\u30bf\u30f3\u30ab\u30fc\u8b77\u885b\u4efb\u52d9","api_details":"\u6cb9\u7530\u5730\u5e2f\u304b\u3089\u71c3\u6599\u3092\u6e80\u8f09\u3057\u3066\u623b\u308b\u30bf\u30f3\u30ab\u30fc\u8239\u56e3\u3092\u8b77\u885b\u3057\u3088\u3046\uff01","api_time":240,"api_difficulty":3,"api_use_fuel":0.5,"api_use_bull":0,"api_active":1,"api_state":2,"api_win_item1":[10,1],"api_win_item2":[1,2]},{"api_id":10,"api_maparea_id":2,"api_name":"\u5f37\u884c\u5075\u5bdf\u4efb\u52d9","api_details":"\u6c34\u4e0a\u5075\u5bdf\u6a5f\u642d\u8f09\u8266\u306a\u3069\u3092\u6d3b\u7528\u3057\u3001\u6575\u8266\u968a\u306e\u52d5\u5411\u3092\u63a2\u308c\uff01","api_time":90,"api_difficulty":3,"api_use_fuel":0.3,"api_use_bull":0,"api_active":1,"api_state":2,"api_win_item1":[1,1],"api_win_item2":[2,1]},{"api_id":11,"api_maparea_id":2,"api_name":"\u30dc\u30fc\u30ad\u30b5\u30a4\u30c8\u8f38\u9001\u4efb\u52d9","api_details":"\u8cc7\u6e90\u96c6\u7a4d\u5730\u304b\u3089\u6bcd\u6e2f\u306b\u3001\u30dc\u30fc\u30ad\u30b5\u30a4\u30c8\u3092\u8f38\u9001\u3057\u3088\u3046\uff01","api_time":300,"api_difficulty":4,"api_use_fuel":0.5,"api_use_bull":0,"api_active":1,"api_state":2,"api_win_item1":[10,1],"api_win_item2":[1,1]},{"api_id":12,"api_maparea_id":2,"api_name":"\u8cc7\u6e90\u8f38\u9001\u4efb\u52d9","api_details":"\u8cc7\u6e90\u56fd\u304b\u3089\u8f38\u5165\u3055\u308c\u308b\u8cc7\u6e90\u3092\u6bcd\u6e2f\u3078\u8b77\u885b\u3057\u3001\u7121\u4e8b\u8f38\u9001\u3092\u5b8c\u4e86\u3057\u3088\u3046\uff01","api_time":480,"api_difficulty":4,"api_use_fuel":0.5,"api_use_bull":0,"api_active":1,"api_state":2,"api_win_item1":[11,1],"api_win_item2":[3,1]},{"api_id":13,"api_maparea_id":2,"api_name":"\u9f20\u8f38\u9001\u4f5c\u6226","api_details":"\u5feb\u901f\u306e\u99c6\u9010\u8266\u3092\u96c6\u4e2d\u904b\u7528\u3057\u3066\u3001\u6fc0\u6226\u306e\u8af8\u5cf6\u3078\u7269\u8cc7\u3092\u8f38\u9001\u3057\u3088\u3046\uff01","api_time":240,"api_difficulty":5,"api_use_fuel":0.5,"api_use_bull":0.4,"api_active":1,"api_state":2,"api_win_item1":[1,2],"api_win_item2":[10,1]},{"api_id":14,"api_maparea_id":2,"api_name":"\u5305\u56f2\u9678\u6226\u968a\u64a4\u53ce\u4f5c\u6226","api_details":"\u6a5f\u52d5\u529b\u306e\u3042\u308b\u5c0f\u8266\u8247\u90e8\u968a\u3092\u7d50\u96c6\u3057\u3001\u5305\u56f2\u4e0b\u306e\u90e8\u968a\u3092\u53ce\u5bb9\u3057\u3088\u3046\uff01","api_time":360,"api_difficulty":5,"api_use_fuel":0.5,"api_use_bull":0,"api_active":1,"api_state":2,"api_win_item1":[1,1],"api_win_item2":[3,1]},{"api_id":15,"api_maparea_id":2,"api_name":"\u56ee\u6a5f\u52d5\u90e8\u968a\u652f\u63f4\u4f5c\u6226","api_details":"\u6575\u6a5f\u52d5\u90e8\u968a\u306e\u6226\u529b\u3092\u8a98\u5f15\u3059\u308b\u7a7a\u6bcd\u3092\u542b\u3080\u56ee\u90e8\u968a\u3067\u3001\u4e3b\u529b\u8266\u968a\u3092\u652f\u63f4\u3057\u3088\u3046\uff01","api_time":720,"api_difficulty":6,"api_use_fuel":0.5,"api_use_bull":0.4,"api_active":1,"api_state":2,"api_win_item1":[12,1],"api_win_item2":[3,1]},{"api_id":16,"api_maparea_id":2,"api_name":"\u8266\u968a\u6c7a\u6226\u63f4\u8b77\u4f5c\u6226","api_details":"\u6709\u529b\u306a\u8266\u968a\u3092\u7de8\u6210\u3057\u3001\u6575\u306e\u80cc\u5f8c\u5074\u9762\u3092\u5947\u8972\u3001\u4e3b\u529b\u306e\u8266\u968a\u6c7a\u6226\u3092\u63f4\u8b77\u3057\u3088\u3046\uff01","api_time":900,"api_difficulty":6,"api_use_fuel":0.5,"api_use_bull":0.4,"api_active":1,"api_state":2,"api_win_item1":[2,2],"api_win_item2":[3,2]}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment