# RuntimeException: Expected a ',' or '}'

**URL:** https://discourse.processing.org/t/runtimeexception-expected-a-or/37990
**Category:** Libraries
**Created:** [July 16, 2022, 5:24pm UTC](https://discourse.processing.org/t/runtimeexception-expected-a-or/37990 "2022-07-16T17:24:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nanto2016](https://avatars.discourse-cdn.com/v4/letter/n/eb9ed0/32.png) [@nanto2016](https://discourse.processing.org/u/nanto2016)
#### Post date: [July 16, 2022, 5:24pm UTC](https://discourse.processing.org/t/runtimeexception-expected-a-or/37990/1 "2022-07-16T17:24:48Z")

</div>

Hi, i was working on a game, it worked when i last tested it, then i went watch video on youtube, and the sketch doesn’t work anymore, and i really do not understand at all where is the error. it just says in the console : `RuntimeException: Expected a ',' or '}'`  
, And i can’t find any syntax error ! there is no problem in the “Errors” tab. When i launch the game, it crashes and highlights line 16 (`data = loadJSONObject("data.json");`). I have also tried commenting out all JSONObject things and that fixed the problem ! The thing is i will need JSON to save the game…

Can someone help me with this ? Thanks !

```auto
import processing.sound.*;
import processing.video.*;

//dice die in rain w : 1920 h : 1080
Movie introMov;
PGraphics settings;
PImage icon;
PFont miriam;
JSONObject data = new JSONObject();
int where = 0, t1, intro, trans, set = -1;

void setup() {
  fullScreen();
  textAlign(CENTER);
  icon = loadImage("icon.png");
  data = loadJSONObject("data.json");
  miriam = loadFont("MiriamMonoCLM-Book-75.vlw");
  settings = createGraphics(width, height);
  surface.setTitle("Dice Die in Rain, which is kinda sad T-T");
  surface.setIcon(icon);
  introMov = new Movie(this, "Dice Die in Rain.avi");
  if(data.getBoolean("introWatched") == true)
    where = 1;
  else {
    //data.setBoolean("introWatched", true);
    //saveJSONObject(data, "data/data.json");
  }
  settings.beginDraw();
  settings.fill(0, 200);
  settings.rect(0, 0, width, height);
  settings.endDraw();
  introMov.play();
  fill(0);
}

void draw() {
  if(where == 0) { //intro
    image(introMov, 0, 0);
    if(introMov.time() == 79.3) {
      delay(2000);
      where = 1;
      data.setBoolean("introWatched", true);
    }
  } else if(where == 1) { //menu
    background(0, 255, 0);
    textSize(100);
    fill(0);
    text("Dice Die in Rain", width/2, height/4);
    textFont(miriam);
    text("Press any key to continue", width/2, height/2);
    textSize(32);
    text("ESC - Settings", width/7.68, 100);
    text("I - Review intro", width - width/7.68, 100);
  } else if(where == 2) {
    background(0);
    textFont(miriam);
    fill(255);
    text("BACKSPACE - exit", width/7.68, 100);
  } else if(where == 3) {
    background(255);
  } else if(where == 4) {
    background(255, 0, 0);
  }
  if(set == 1) {
    image(settings, 0, 0);
  }
}

void movieEvent(Movie introMov) {
    introMov.read();
}

void keyPressed() {
  String Key = str(key);
  Key = Key.toLowerCase();
  key = Key.charAt(0);
  if(keyCode == ESC && where != 0)
    key = 0;
  if(set == -1)
    switch(where) {
      case 0 : where = 1; introMov.stop(); break;
      case 1 : if(key == 0) where = 2; else if(key == 'i') { introMov.jump(0); delay(100); where = 0; } else where = 3; break;
      case 2 : if(key == 0) where = 1; else if(keyCode == BACKSPACE) { /*save*/ exit(); } break;
      case 3 : if(key == 0) set *= -1; break;
      case 4 : if(key == 0) set *= -1;
    }
  else {
    if(keyCode == BACKSPACE) {
      //save
      where = 1;
    } else if(key == 0)
      set *= -1;
  }
}

void mousePressed() {
  if(where == 1)
    where = 3;
}

```

---

<div class="post-metadata">

### Author: ![nanto2016](https://avatars.discourse-cdn.com/v4/letter/n/eb9ed0/32.png) [@nanto2016](https://discourse.processing.org/u/nanto2016)
#### Post date: [July 16, 2022, 5:30pm UTC](https://discourse.processing.org/t/runtimeexception-expected-a-or/37990/2 "2022-07-16T17:30:44Z")

</div>

Oops ! Just found out i made a typo IN the json file, rather than in the sketch, the was a missing colon… Sorry ! But may this be helpful to all others who find themselves in the same problematic situation !

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [July 16, 2022, 5:30pm UTC](https://discourse.processing.org/t/runtimeexception-expected-a-or/37990/3 "2022-07-16T17:30:56Z")

</div>

The problem is almost certainly caused during parsing of the `data.json` file. I suspect that the file contents are no longer valid json format.
