Click here to Skip to main content
15,888,527 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Maybe my least favorite programming task other than CRUD creation Pin
Fueled By Decaff9-Dec-20 3:19
Fueled By Decaff9-Dec-20 3:19 
GeneralRe: Maybe my least favorite programming task other than CRUD creation Pin
jsc429-Dec-20 2:51
professionaljsc429-Dec-20 2:51 
GeneralRe: Maybe my least favorite programming task other than CRUD creation Pin
PIEBALDconsult9-Dec-20 3:19
mvePIEBALDconsult9-Dec-20 3:19 
GeneralRe: Maybe my least favorite programming task other than CRUD creation Pin
honey the codewitch9-Dec-20 3:22
mvahoney the codewitch9-Dec-20 3:22 
GeneralRe: Maybe my least favorite programming task other than CRUD creation Pin
PIEBALDconsult9-Dec-20 3:49
mvePIEBALDconsult9-Dec-20 3:49 
GeneralRe: Maybe my least favorite programming task other than CRUD creation Pin
honey the codewitch9-Dec-20 3:54
mvahoney the codewitch9-Dec-20 3:54 
GeneralRe: Maybe my least favorite programming task other than CRUD creation Pin
PIEBALDconsult9-Dec-20 6:47
mvePIEBALDconsult9-Dec-20 6:47 
GeneralRe: Maybe my least favorite programming task other than CRUD creation Pin
honey the codewitch9-Dec-20 6:52
mvahoney the codewitch9-Dec-20 6:52 
It's probably easiest just to show you:

C++
  // initialize the reader with our file
  jsonReader.begin(file);

  // pull parsers return portions of the parse which you retrieve
  // by calling their parse/read method in a loop.
  while (jsonReader.read()) {
    // what kind of JSON element are we on?
    switch (jsonReader.nodeType()) {
      case JsonReader2k::Value: // we're on a scalar value
        Serial.print("Value ");
        switch (jsonReader.valueType()) { // what type of value?
          case JsonReader2k::String: // a string!
            Serial.print("String: ");
            jsonReader.undecorate(); // remove all the nonsense
            Serial.println(jsonReader.value()); // print it
            break;
          case JsonReader2k::Number: // a number!
            Serial.print("Number: ");
            Serial.println(jsonReader.numericValue()); // print it
            break;
          case JsonReader2k::Boolean: // a boolean! 
            Serial.print("Boolean: ");
            Serial.println(jsonReader.booleanValue()); // print it!
            break;
          case JsonReader2k::Null: // a null!
            Serial.print("Null: ");
            Serial.println("null"); // print it!
            break;
        }
        break;
      case JsonReader2k::Key: // this is a key
        Serial.print("Key ");
        Serial.println(jsonReader.value());
        break;
      case JsonReader2k::Object: // an object start {
        Serial.println("Object");
        break;
      case JsonReader2k::EndObject: // an object end }
        Serial.println("End Object");
        break;
      case JsonReader2k::Array: // an array start [
        Serial.println("Array");
        break;
      case JsonReader2k::EndArray: // an array end ]
        Serial.println("End Array");
        break;
      case JsonReader2k::Error: // a bad thing
        // maybe we ran out of memory, or the document was poorly formed
        Serial.println("Error!");
        break;
    }
  }
  // don't forget this
  file.close();
}


Which emits this:
Object
Key "backdrop_path"
Value String: /lgTB0XOd4UFixecZgwWrsR69AxY.jpg
Key "created_by"
Array
Object
Key "id"
Value Number: 1233032.00
Key "credit_id"
Value String: 525749f819c29531db09b231
Key "name"
Value String: Matt Nix
Key "profile_path"
Value String: /qvfbD7kc7nU3RklhFZDx9owIyrY.jpg
End Object
End Array
Key "episode_run_time"
Array
Value Number: 45.00
End Array
Key "first_air_date"
Value String: 2007-06-28
Key "genres"

For this:
JavaScript
{
  "backdrop_path": "/lgTB0XOd4UFixecZgwWrsR69AxY.jpg",
  "created_by": [
      {
        "id": 1233032,
        "credit_id": "525749f819c29531db09b231",
        "name": "Matt Nix",
        "profile_path": "/qvfbD7kc7nU3RklhFZDx9owIyrY.jpg"
      }
    ],
  "episode_run_time": [
      45
    ],
  "first_air_date": "2007-06-28",
  "genres":
...


It sounds like you're doing something similar except dumping to a database whereas I'm just spewing debug to the serial port for demonstration. (This is arduino C++ code)
Real programmers use butterflies


modified 9-Dec-20 12:58pm.

General/dev/null as a service PinPopular
Brisingr Aerowing8-Dec-20 15:19
professionalBrisingr Aerowing8-Dec-20 15:19 
PraiseRe: /dev/null as a service Pin
Daniel Pfeffer8-Dec-20 19:31
professionalDaniel Pfeffer8-Dec-20 19:31 
GeneralRe: /dev/null as a service Pin
Johnny J.8-Dec-20 21:03
professionalJohnny J.8-Dec-20 21:03 
GeneralRe: /dev/null as a service Pin
5teveH8-Dec-20 21:30
5teveH8-Dec-20 21:30 
GeneralRe: /dev/null as a service Pin
k50549-Dec-20 3:51
mvek50549-Dec-20 3:51 
GeneralRe: /dev/null as a service Pin
5teveH9-Dec-20 4:05
5teveH9-Dec-20 4:05 
GeneralRe: /dev/null as a service Pin
BabyYoda9-Dec-20 2:57
BabyYoda9-Dec-20 2:57 
GeneralRe: /dev/null as a service Pin
Jörgen Andersson9-Dec-20 5:51
professionalJörgen Andersson9-Dec-20 5:51 
GeneralI did not realize... Pin
David O'Neil8-Dec-20 13:44
professionalDavid O'Neil8-Dec-20 13:44 
GeneralRe: I did not realize... Pin
Greg Utas8-Dec-20 13:54
professionalGreg Utas8-Dec-20 13:54 
GeneralRe: I did not realize... Pin
Nelek8-Dec-20 21:49
protectorNelek8-Dec-20 21:49 
GeneralRe: I did not realize... Pin
Greg Utas8-Dec-20 23:38
professionalGreg Utas8-Dec-20 23:38 
GeneralRe: I did not realize... Pin
Rick York8-Dec-20 14:29
mveRick York8-Dec-20 14:29 
GeneralRe: I did not realize... Pin
Dan Neely9-Dec-20 2:30
Dan Neely9-Dec-20 2:30 
GeneralRe: I did not realize... Pin
David O'Neil9-Dec-20 6:43
professionalDavid O'Neil9-Dec-20 6:43 
GeneralRe: I did not realize... Pin
Dan Neely9-Dec-20 6:55
Dan Neely9-Dec-20 6:55 
GeneralRe: I did not realize... Pin
David O'Neil9-Dec-20 7:20
professionalDavid O'Neil9-Dec-20 7:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.