How to post JSON data with null as value in python request [duplicate]











up vote
-1
down vote

favorite













This question already has an answer here:




  • Why can't I use true/false/null in a Python object fed to json.dumps()?

    3 answers




I have JSON data which which needs to formated and sent to the server with null values set as null.
A dictionary in Python cannot have null as value but can have "null" as a value. How do I convert the above to a dictionary that Python recognizes?



a = {"name":"p_retailprice","type":"DOUBLE","comment":"","precision":null,"scale":null}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'null' is not defined









share|improve this question







New contributor




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











marked as duplicate by jonrsharpe python
Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
yesterday


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















    up vote
    -1
    down vote

    favorite













    This question already has an answer here:




    • Why can't I use true/false/null in a Python object fed to json.dumps()?

      3 answers




    I have JSON data which which needs to formated and sent to the server with null values set as null.
    A dictionary in Python cannot have null as value but can have "null" as a value. How do I convert the above to a dictionary that Python recognizes?



    a = {"name":"p_retailprice","type":"DOUBLE","comment":"","precision":null,"scale":null}
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    NameError: name 'null' is not defined









    share|improve this question







    New contributor




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











    marked as duplicate by jonrsharpe python
    Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

    StackExchange.ready(function() {
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function() {
    $hover.showInfoMessage('', {
    messageElement: $msg.clone().show(),
    transient: false,
    position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
    dismissable: false,
    relativeToBody: true
    });
    },
    function() {
    StackExchange.helpers.removeMessages();
    }
    );
    });
    });
    yesterday


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

















      up vote
      -1
      down vote

      favorite









      up vote
      -1
      down vote

      favorite












      This question already has an answer here:




      • Why can't I use true/false/null in a Python object fed to json.dumps()?

        3 answers




      I have JSON data which which needs to formated and sent to the server with null values set as null.
      A dictionary in Python cannot have null as value but can have "null" as a value. How do I convert the above to a dictionary that Python recognizes?



      a = {"name":"p_retailprice","type":"DOUBLE","comment":"","precision":null,"scale":null}
      Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      NameError: name 'null' is not defined









      share|improve this question







      New contributor




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












      This question already has an answer here:




      • Why can't I use true/false/null in a Python object fed to json.dumps()?

        3 answers




      I have JSON data which which needs to formated and sent to the server with null values set as null.
      A dictionary in Python cannot have null as value but can have "null" as a value. How do I convert the above to a dictionary that Python recognizes?



      a = {"name":"p_retailprice","type":"DOUBLE","comment":"","precision":null,"scale":null}
      Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      NameError: name 'null' is not defined




      This question already has an answer here:




      • Why can't I use true/false/null in a Python object fed to json.dumps()?

        3 answers








      python json post






      share|improve this question







      New contributor




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











      share|improve this question







      New contributor




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









      share|improve this question




      share|improve this question






      New contributor




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









      asked yesterday









      Dhananjay Singh

      11




      11




      New contributor




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





      New contributor





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






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




      marked as duplicate by jonrsharpe python
      Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      yesterday


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






      marked as duplicate by jonrsharpe python
      Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      yesterday


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          The equivalent of the null keyword in Python is None.



          Try



          a = {"name":"p_retailprice","type":"DOUBLE","comment":"","precision":None,"scale":None}





          share|improve this answer








          New contributor




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

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            The equivalent of the null keyword in Python is None.



            Try



            a = {"name":"p_retailprice","type":"DOUBLE","comment":"","precision":None,"scale":None}





            share|improve this answer








            New contributor




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






















              up vote
              1
              down vote













              The equivalent of the null keyword in Python is None.



              Try



              a = {"name":"p_retailprice","type":"DOUBLE","comment":"","precision":None,"scale":None}





              share|improve this answer








              New contributor




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




















                up vote
                1
                down vote










                up vote
                1
                down vote









                The equivalent of the null keyword in Python is None.



                Try



                a = {"name":"p_retailprice","type":"DOUBLE","comment":"","precision":None,"scale":None}





                share|improve this answer








                New contributor




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









                The equivalent of the null keyword in Python is None.



                Try



                a = {"name":"p_retailprice","type":"DOUBLE","comment":"","precision":None,"scale":None}






                share|improve this answer








                New contributor




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









                share|improve this answer



                share|improve this answer






                New contributor




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









                answered yesterday









                Paritosh Singh

                1665




                1665




                New contributor




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





                New contributor





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






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















                    Popular posts from this blog

                    Bressuire

                    Vorschmack

                    Quarantine