Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 969903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:43:13+00:00 2026-05-16T02:43:13+00:00

I try reading a JSON file from R using rjson but keep getting errors.

  • 0

I try reading a JSON file from R using rjson but keep getting errors. I validated the JSON file using various online validators. Here is the content of the JSON file:

{
   "scenarios": [
      {
         "files": {
            "type1": "/home/blah/Desktop/temp/scen_0.type1",
            "type2": "/home/blah/Desktop/temp/scen_0.type2"
         },
         "ID": "scen_0",
         "arr": [],
         "TypeToElementStatsFilename": {
            "type1": "/home/blah/Desktop/temp/scen_0.type1.elements",
            "type2": "/home/blah/Desktop/temp/scen_0.type2.elements"
         }
      }
   ],
   "randomSeed": "39327314969888",
   "zone": {
      "length": 1000000,
      "start": 1
   },
   "instanceFilename": "/home/blah/bloo/data/XY112.zip",
   "txtFilename": "/home/blah/bloo/data/XY112.txt",
   "nSimulations": 2,
   "TypeTodbFilename": {
      "type1": "/home/blah/bloo/data/map.type1.oneAmb.XY112.out"
   },
   "arr": {
      "seg11": {
         "length": 1000,
         "start": 147000
      },
      "seg12": {
         "length": 1000,
         "start": 153000
      },
      "seg5": {
         "length": 1000,
         "start": 145000
      },
      "seg6": {
         "length": 1000,
         "start": 146000
      },
      "seg1": {
         "length": 100,
         "start": 20000
      }
   },
   "outPath": "/home/blah/Desktop/temp",
   "instanceID": "XY112",
   "arrIds": [
      "seg5",
      "seg6",
      "seg1",
      "seg11",
      "seg12"
   ],
   "truth": {
      "files": {
         "type1": "/home/blah/Desktop/temp/truth.type1",
         "type2": "/home/blah/Desktop/temp/truth.type2"
      },
      "ID": "truth",
      "TypeToElementStatsFilename": {
         "type1": "/home/blah/Desktop/temp/truth.type1.elements",
         "type2": "/home/blah/Desktop/temp/truth.type2.elements"
      }
   }
}

And the error:

> json_file <- "~/json"
> json_data <- fromJSON(paste(readLines(json_file), collapse=""))
Error in fromJSON(paste(readLines(json_file), collapse = "")) :
  unexpected character: :
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:43:14+00:00Added an answer on May 16, 2026 at 2:43 am

    RJSON freaks out about empty arrays.

    fromJSON( ‘{ “arr”: [ ] }’)

    Error in fromJSON(“{ \”arr\”: [ ] }”) : unexpected character: :

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using JSON.Net to try and deserialize some survey responses from SurveyGizmo. Here's a
I create a pipe using mkfifo /tmp/foo.pipe Now, I want to try reading from
I am reading JSON code from the database and then parsing the string using
when I try to open a file for reading in my console application i
I am reading properties file in the Dynamic web application as follows : try
How I can start reading from a specific byte? I have following code: try
Currently I using the following code to get my JSON output from MySQL. <?php
I'm reading an html file like this: try { BufferedReader bufferReader = new BufferedReader(new
I try reading data from SQL Server 2005 and filling it in a TableAdapter
I've been reading various posts on Stack Overflow to try and find an ideal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.