How to include the bit in json while converting json to dataset












0















In my Dot Net Core Web project I have to dump the Json data to the the Database.



My json data is as follows



{
'FactTable': 'TranMast',
'LastCdt':'2018-03-01 01:19:17 pm',
'DigiAgentDetId':'12',
'DigiAgentId':'34',
'LastSeqNo':'23',
'Deleted':'1',
'DataSet':{
'TranDet':[
{'Id':'1','TranMastId':'53_25','AcMastId':'sdsd','Account':'sdsd','Amount':'23000','MemName':'dsds','LocId':'ewsds','PartyMastId':'dsdsd','PartyMemId':'23232','AcParentId':'dsdsd','Deleted':'1'},
{'Id':'2','TranMastId':'53_25','AcMastId':'sdsd','Account':'sdsd','Amount':'24000','MemName':'dsds','LocId':'ewsds','PartyMastId':'dsdsd','PartyMemId':'23232','AcParentId':'dsdsd','Deleted':'1'},
{'Id':'3','TranMastId':'53_25','AcMastId':'sdsd','Account':'sdsd','Amount':'25000','MemName':'dsds','LocId':'ewsds','PartyMastId':'dsdsd','PartyMemId':'23232','AcParentId':'dsdsd','Deleted':'1'}
]
}
}


I am construting above json to dataset as following



  var myUtil = JsonConvert.DeserializeObject<MyTableUtilClass>(json);


Where MyTableUtilClass have the follwing structure



public class MyTableUtilClass
{
public string LastCdt { get; set; }
public string DigiAgentId { get; set; }
public string DigiAgentDetId { get; set; }
public string LastSeqNo { get; set; }
public string FactTable { get; set; }
public DataSet DataSet { get; set; }
}


While trying to dump the table in the dataset to the database. in follwing code i am getting the error



int result = adapter.Update(table);


The Error I Am getting is



Failed to convert parameter value from a String to a Boolean


I know the couse of the problem is the field name Deleted is of type bit.



Then in which format i have to include the bit data in the json string.










share|improve this question




















  • 1





    Try more like numeric: 'Deleted':1 instead putting the 1 or 0 inside of a string. Or try writing it as a boolean (because really that's what it is representing: 'Deleted':true). P.S. strictly what you showed is not valid JSON - property names and strings must be surrounded by double quotes (not single quotes) in compliant JSON. Luckily, your de-serialiser is kind to you and tolerates the mistake, but other software might not accept it.

    – ADyson
    Nov 16 '18 at 9:58













  • Thank you for your suggestion , but i am not able to insert value inside the bit field

    – rakshi
    Nov 17 '18 at 6:35






  • 1





    What happens when you try each of my examples? If you still get errors please explain exactly what you see. Thanks

    – ADyson
    Nov 17 '18 at 9:47











  • When i tried 'Deleted':1 the datatype in the dataset for the deleted field is Int16. so gets error like Failed to convert parameter value from a Int to a Boolean

    – rakshi
    Nov 19 '18 at 7:01











  • and the second suggestion?

    – ADyson
    Nov 19 '18 at 9:29
















0















In my Dot Net Core Web project I have to dump the Json data to the the Database.



My json data is as follows



{
'FactTable': 'TranMast',
'LastCdt':'2018-03-01 01:19:17 pm',
'DigiAgentDetId':'12',
'DigiAgentId':'34',
'LastSeqNo':'23',
'Deleted':'1',
'DataSet':{
'TranDet':[
{'Id':'1','TranMastId':'53_25','AcMastId':'sdsd','Account':'sdsd','Amount':'23000','MemName':'dsds','LocId':'ewsds','PartyMastId':'dsdsd','PartyMemId':'23232','AcParentId':'dsdsd','Deleted':'1'},
{'Id':'2','TranMastId':'53_25','AcMastId':'sdsd','Account':'sdsd','Amount':'24000','MemName':'dsds','LocId':'ewsds','PartyMastId':'dsdsd','PartyMemId':'23232','AcParentId':'dsdsd','Deleted':'1'},
{'Id':'3','TranMastId':'53_25','AcMastId':'sdsd','Account':'sdsd','Amount':'25000','MemName':'dsds','LocId':'ewsds','PartyMastId':'dsdsd','PartyMemId':'23232','AcParentId':'dsdsd','Deleted':'1'}
]
}
}


I am construting above json to dataset as following



  var myUtil = JsonConvert.DeserializeObject<MyTableUtilClass>(json);


Where MyTableUtilClass have the follwing structure



public class MyTableUtilClass
{
public string LastCdt { get; set; }
public string DigiAgentId { get; set; }
public string DigiAgentDetId { get; set; }
public string LastSeqNo { get; set; }
public string FactTable { get; set; }
public DataSet DataSet { get; set; }
}


While trying to dump the table in the dataset to the database. in follwing code i am getting the error



int result = adapter.Update(table);


The Error I Am getting is



Failed to convert parameter value from a String to a Boolean


I know the couse of the problem is the field name Deleted is of type bit.



Then in which format i have to include the bit data in the json string.










share|improve this question




















  • 1





    Try more like numeric: 'Deleted':1 instead putting the 1 or 0 inside of a string. Or try writing it as a boolean (because really that's what it is representing: 'Deleted':true). P.S. strictly what you showed is not valid JSON - property names and strings must be surrounded by double quotes (not single quotes) in compliant JSON. Luckily, your de-serialiser is kind to you and tolerates the mistake, but other software might not accept it.

    – ADyson
    Nov 16 '18 at 9:58













  • Thank you for your suggestion , but i am not able to insert value inside the bit field

    – rakshi
    Nov 17 '18 at 6:35






  • 1





    What happens when you try each of my examples? If you still get errors please explain exactly what you see. Thanks

    – ADyson
    Nov 17 '18 at 9:47











  • When i tried 'Deleted':1 the datatype in the dataset for the deleted field is Int16. so gets error like Failed to convert parameter value from a Int to a Boolean

    – rakshi
    Nov 19 '18 at 7:01











  • and the second suggestion?

    – ADyson
    Nov 19 '18 at 9:29














0












0








0








In my Dot Net Core Web project I have to dump the Json data to the the Database.



My json data is as follows



{
'FactTable': 'TranMast',
'LastCdt':'2018-03-01 01:19:17 pm',
'DigiAgentDetId':'12',
'DigiAgentId':'34',
'LastSeqNo':'23',
'Deleted':'1',
'DataSet':{
'TranDet':[
{'Id':'1','TranMastId':'53_25','AcMastId':'sdsd','Account':'sdsd','Amount':'23000','MemName':'dsds','LocId':'ewsds','PartyMastId':'dsdsd','PartyMemId':'23232','AcParentId':'dsdsd','Deleted':'1'},
{'Id':'2','TranMastId':'53_25','AcMastId':'sdsd','Account':'sdsd','Amount':'24000','MemName':'dsds','LocId':'ewsds','PartyMastId':'dsdsd','PartyMemId':'23232','AcParentId':'dsdsd','Deleted':'1'},
{'Id':'3','TranMastId':'53_25','AcMastId':'sdsd','Account':'sdsd','Amount':'25000','MemName':'dsds','LocId':'ewsds','PartyMastId':'dsdsd','PartyMemId':'23232','AcParentId':'dsdsd','Deleted':'1'}
]
}
}


I am construting above json to dataset as following



  var myUtil = JsonConvert.DeserializeObject<MyTableUtilClass>(json);


Where MyTableUtilClass have the follwing structure



public class MyTableUtilClass
{
public string LastCdt { get; set; }
public string DigiAgentId { get; set; }
public string DigiAgentDetId { get; set; }
public string LastSeqNo { get; set; }
public string FactTable { get; set; }
public DataSet DataSet { get; set; }
}


While trying to dump the table in the dataset to the database. in follwing code i am getting the error



int result = adapter.Update(table);


The Error I Am getting is



Failed to convert parameter value from a String to a Boolean


I know the couse of the problem is the field name Deleted is of type bit.



Then in which format i have to include the bit data in the json string.










share|improve this question
















In my Dot Net Core Web project I have to dump the Json data to the the Database.



My json data is as follows



{
'FactTable': 'TranMast',
'LastCdt':'2018-03-01 01:19:17 pm',
'DigiAgentDetId':'12',
'DigiAgentId':'34',
'LastSeqNo':'23',
'Deleted':'1',
'DataSet':{
'TranDet':[
{'Id':'1','TranMastId':'53_25','AcMastId':'sdsd','Account':'sdsd','Amount':'23000','MemName':'dsds','LocId':'ewsds','PartyMastId':'dsdsd','PartyMemId':'23232','AcParentId':'dsdsd','Deleted':'1'},
{'Id':'2','TranMastId':'53_25','AcMastId':'sdsd','Account':'sdsd','Amount':'24000','MemName':'dsds','LocId':'ewsds','PartyMastId':'dsdsd','PartyMemId':'23232','AcParentId':'dsdsd','Deleted':'1'},
{'Id':'3','TranMastId':'53_25','AcMastId':'sdsd','Account':'sdsd','Amount':'25000','MemName':'dsds','LocId':'ewsds','PartyMastId':'dsdsd','PartyMemId':'23232','AcParentId':'dsdsd','Deleted':'1'}
]
}
}


I am construting above json to dataset as following



  var myUtil = JsonConvert.DeserializeObject<MyTableUtilClass>(json);


Where MyTableUtilClass have the follwing structure



public class MyTableUtilClass
{
public string LastCdt { get; set; }
public string DigiAgentId { get; set; }
public string DigiAgentDetId { get; set; }
public string LastSeqNo { get; set; }
public string FactTable { get; set; }
public DataSet DataSet { get; set; }
}


While trying to dump the table in the dataset to the database. in follwing code i am getting the error



int result = adapter.Update(table);


The Error I Am getting is



Failed to convert parameter value from a String to a Boolean


I know the couse of the problem is the field name Deleted is of type bit.



Then in which format i have to include the bit data in the json string.







json .net-core dataset






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 8:14







rakshi

















asked Nov 16 '18 at 7:02









rakshirakshi

315216




315216








  • 1





    Try more like numeric: 'Deleted':1 instead putting the 1 or 0 inside of a string. Or try writing it as a boolean (because really that's what it is representing: 'Deleted':true). P.S. strictly what you showed is not valid JSON - property names and strings must be surrounded by double quotes (not single quotes) in compliant JSON. Luckily, your de-serialiser is kind to you and tolerates the mistake, but other software might not accept it.

    – ADyson
    Nov 16 '18 at 9:58













  • Thank you for your suggestion , but i am not able to insert value inside the bit field

    – rakshi
    Nov 17 '18 at 6:35






  • 1





    What happens when you try each of my examples? If you still get errors please explain exactly what you see. Thanks

    – ADyson
    Nov 17 '18 at 9:47











  • When i tried 'Deleted':1 the datatype in the dataset for the deleted field is Int16. so gets error like Failed to convert parameter value from a Int to a Boolean

    – rakshi
    Nov 19 '18 at 7:01











  • and the second suggestion?

    – ADyson
    Nov 19 '18 at 9:29














  • 1





    Try more like numeric: 'Deleted':1 instead putting the 1 or 0 inside of a string. Or try writing it as a boolean (because really that's what it is representing: 'Deleted':true). P.S. strictly what you showed is not valid JSON - property names and strings must be surrounded by double quotes (not single quotes) in compliant JSON. Luckily, your de-serialiser is kind to you and tolerates the mistake, but other software might not accept it.

    – ADyson
    Nov 16 '18 at 9:58













  • Thank you for your suggestion , but i am not able to insert value inside the bit field

    – rakshi
    Nov 17 '18 at 6:35






  • 1





    What happens when you try each of my examples? If you still get errors please explain exactly what you see. Thanks

    – ADyson
    Nov 17 '18 at 9:47











  • When i tried 'Deleted':1 the datatype in the dataset for the deleted field is Int16. so gets error like Failed to convert parameter value from a Int to a Boolean

    – rakshi
    Nov 19 '18 at 7:01











  • and the second suggestion?

    – ADyson
    Nov 19 '18 at 9:29








1




1





Try more like numeric: 'Deleted':1 instead putting the 1 or 0 inside of a string. Or try writing it as a boolean (because really that's what it is representing: 'Deleted':true). P.S. strictly what you showed is not valid JSON - property names and strings must be surrounded by double quotes (not single quotes) in compliant JSON. Luckily, your de-serialiser is kind to you and tolerates the mistake, but other software might not accept it.

– ADyson
Nov 16 '18 at 9:58







Try more like numeric: 'Deleted':1 instead putting the 1 or 0 inside of a string. Or try writing it as a boolean (because really that's what it is representing: 'Deleted':true). P.S. strictly what you showed is not valid JSON - property names and strings must be surrounded by double quotes (not single quotes) in compliant JSON. Luckily, your de-serialiser is kind to you and tolerates the mistake, but other software might not accept it.

– ADyson
Nov 16 '18 at 9:58















Thank you for your suggestion , but i am not able to insert value inside the bit field

– rakshi
Nov 17 '18 at 6:35





Thank you for your suggestion , but i am not able to insert value inside the bit field

– rakshi
Nov 17 '18 at 6:35




1




1





What happens when you try each of my examples? If you still get errors please explain exactly what you see. Thanks

– ADyson
Nov 17 '18 at 9:47





What happens when you try each of my examples? If you still get errors please explain exactly what you see. Thanks

– ADyson
Nov 17 '18 at 9:47













When i tried 'Deleted':1 the datatype in the dataset for the deleted field is Int16. so gets error like Failed to convert parameter value from a Int to a Boolean

– rakshi
Nov 19 '18 at 7:01





When i tried 'Deleted':1 the datatype in the dataset for the deleted field is Int16. so gets error like Failed to convert parameter value from a Int to a Boolean

– rakshi
Nov 19 '18 at 7:01













and the second suggestion?

– ADyson
Nov 19 '18 at 9:29





and the second suggestion?

– ADyson
Nov 19 '18 at 9:29












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53332955%2fhow-to-include-the-bit-in-json-while-converting-json-to-dataset%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
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • 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%2fstackoverflow.com%2fquestions%2f53332955%2fhow-to-include-the-bit-in-json-while-converting-json-to-dataset%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

The Sandy Post

Danny Elfman

Pages that link to "Head v. Amoskeag Manufacturing Co."