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













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();

);
);
);
Nov 10 at 11:50


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













    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();

    );
    );
    );
    Nov 10 at 11:50


    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














      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













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 10 at 11:44









      Dhananjay Singh

      11




      11




      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();

      );
      );
      );
      Nov 10 at 11:50


      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();

      );
      );
      );
      Nov 10 at 11:50


      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



























            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
























              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






















                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












                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












                share|improve this answer



                share|improve this answer










                answered Nov 10 at 11:48









                Paritosh Singh

                5458




                5458













                    Popular posts from this blog

                    Kleinkühnau

                    Makov (Slowakei)

                    Deutsches Schauspielhaus