Getting the contents of a json file as a variable in plpgsql?Postgresql nested row_to_json not workingHow to...

In a Spin are Both Wings Stalled?

What's the difference between 'rename' and 'mv'?

UK: Is there precedent for the governments e-petition site changing the direction of a government decision?

Did Shadowfax go to Valinor?

How do I write bicross product symbols in latex?

Why is the 'in' operator throwing an error with a string literal instead of logging false?

I Accidentally Deleted a Stock Terminal Theme

Is the Joker left-handed?

Forgetting the musical notes while performing in concert

Reserved de-dupe rules

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?

Fully-Firstable Anagram Sets

Took a trip to a parallel universe, need help deciphering

Is it inappropriate for a student to attend their mentor's dissertation defense?

How can I prevent hyper evolved versions of regular creatures from wiping out their cousins?

Watching something be written to a file live with tail

Why does Arabsat 6A need a Falcon Heavy to launch

How to model explosives?

Why are electrically insulating heatsinks so rare? Is it just cost?

Why doesn't H₄O²⁺ exist?

Arrow those variables!

What to put in ESTA if staying in US for a few days before going on to Canada

What's the point of deactivating Num Lock on login screens?

Stopping power of mountain vs road bike



Getting the contents of a json file as a variable in plpgsql?


Postgresql nested row_to_json not workingHow to understand “object-relational”?Postgres function to merge two json objects with overlapping keys into one objectUpdate Postgres Table with Array of JSONInsert Array of JSON into Postgres TablePostgreSQL function param json_populate_recordset ARRAY problemSQL Server 2016 Nested JSON Arraypostgresql function CAST json ARRAY to A TYPEUnmarshalling Hierarchical JSON in SQL Server 2016+How to read jsonb or json in postgresql spi?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















So I have a large .json document with a hierarchy like [{"A":{"B":1}}, {"A":{"B":2}} ...] where there is one array as the top level object.



I'm trying to load this file into a table such that the rows look like this 1|{"A":{"B":2}}. Based on this incredible answer by Doctor Eval I know how to do this from a terminal utilizing those steps + the json_array_elements() function, but I can't figure out how to replicate it in plpgsql. I understand that set can't be used in plpgsql scripts.









share







New contributor




knowads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



























    0















    So I have a large .json document with a hierarchy like [{"A":{"B":1}}, {"A":{"B":2}} ...] where there is one array as the top level object.



    I'm trying to load this file into a table such that the rows look like this 1|{"A":{"B":2}}. Based on this incredible answer by Doctor Eval I know how to do this from a terminal utilizing those steps + the json_array_elements() function, but I can't figure out how to replicate it in plpgsql. I understand that set can't be used in plpgsql scripts.









    share







    New contributor




    knowads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      So I have a large .json document with a hierarchy like [{"A":{"B":1}}, {"A":{"B":2}} ...] where there is one array as the top level object.



      I'm trying to load this file into a table such that the rows look like this 1|{"A":{"B":2}}. Based on this incredible answer by Doctor Eval I know how to do this from a terminal utilizing those steps + the json_array_elements() function, but I can't figure out how to replicate it in plpgsql. I understand that set can't be used in plpgsql scripts.









      share







      New contributor




      knowads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      So I have a large .json document with a hierarchy like [{"A":{"B":1}}, {"A":{"B":2}} ...] where there is one array as the top level object.



      I'm trying to load this file into a table such that the rows look like this 1|{"A":{"B":2}}. Based on this incredible answer by Doctor Eval I know how to do this from a terminal utilizing those steps + the json_array_elements() function, but I can't figure out how to replicate it in plpgsql. I understand that set can't be used in plpgsql scripts.







      postgresql json plpgsql





      share







      New contributor




      knowads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      knowads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      knowads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 7 mins ago









      knowadsknowads

      101




      101




      New contributor




      knowads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      knowads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      knowads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "182"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          knowads is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f233995%2fgetting-the-contents-of-a-json-file-as-a-variable-in-plpgsql%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          knowads is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          knowads is a new contributor. Be nice, and check out our Code of Conduct.













          knowads is a new contributor. Be nice, and check out our Code of Conduct.












          knowads is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Database Administrators Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f233995%2fgetting-the-contents-of-a-json-file-as-a-variable-in-plpgsql%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Parapolítica Índice Antecedentes El escándalo Proceso judicial Consecuencias Véase...

          How to remove border from elements in the last row?Targeting flex items on the last rowHow to vertically wrap...

          Tecnologías entrañables Índice Antecedentes Desarrollo Tecnologías Entrañables en la...