cross-posted from: https://lemmy.nz/post/4294116

I have a file with content like this:

item({
     ["attr"] = {
        ["size"] = "62091";
        ["filename"] = "qBuUP9-OTfuzibt6PQX4-g.jpg";
        ["stamp"] = "2023-12-05T19:31:37Z";
        ["xmlns"] = "urn:xmpp:http:upload:0";
        ["content-type"] = "image/jpeg";
     };
     ["key"] = "Wa4AJWFldqRZjBozponbSLRZ";
     ["with"] = "email@address";
     ["when"] = 1701804697;
     ["name"] = "request";
});

I need to know what format this is, and if there exists a tool in linux already to parse this or if I need to write one myself?

Thanks!

  • anon5621
    link
    fedilink
    arrow-up
    2
    arrow-down
    25
    ·
    1 year ago

    This is JSON.A lot cli tools exist to manilulate json files.Example: jq

    • Semperverus@lemmy.world
      link
      fedilink
      English
      arrow-up
      17
      ·
      edit-2
      1 year ago

      I thought json at first too but json does not use brackets around its keys like that or semicolons to end a key value pair, it uses commas. It also doesnt use equal signs for the value assignments, it uses colons.