Click here to Skip to main content
15,868,419 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to make json string formate suitable to select statement as following :

SQL
select FooterTable.LineNumber,FooterTable.ItemCode,FooterTable.Quantity,FooterTable.UniPrice,FooterTable.Total from

MasterTable inner join  FooterTable on MasterTable.Serial=FooterTable.Serial,MasterTable.BranchCode=FooterTable.BranchCode,MasterTable.Year=FooterTable.Year

where MasterTable.Serial=10 AND MasterTable.Year=2019 AND MasterTable.BranchCode=1


No need for code by any language

only string fomate like that
{
xxxx
}

MasterTable
Serial pk
Year pk
BranchCode pk

FooterTable
Serial pk
Year pk
BranchCode pk
LineNumber
ItemCode
Quantity
UniPrice
Total

How to generate json string as following

Fields : LineNumber,ItemCode,Quantity,UniPrice,Total specified all fields from
FooterTable no fields from MasterTable .

Keys : Serial:10,Year:2019,BranchCode:1 from MasterTable .

Tables:MasterTable,FooterTable .



so that how to generate json format string to my requirement above

What I have tried:

{
"Details" : {
       "table" : "master_table",
       "fields" : {
               "itemCode" : "item-5050",
               "Quantity" : "10" ,
               "Price" : "50" ,
               "Total" : "500"
           },
       "keys":   {
           "BranchCode" : 1 ,
           "Year" : 2019 ,
           "Serial" : 2 
       }      
   }
}
Posted
Updated 20-Sep-19 22:13pm
v3

1 solution

Quote:
Take a look at: JSON Utils: Generate C#, VB.Net, SQL Table, Java and PHP from JSON[^] and select SQL Table.
Your JSON is probably a bit too complex for the website, try to simplify like this:
{
"details" :  {
"name":"Johnson, Smith, and Jones Co.",    
"amount":123456.78,    
"Remark":"Pays on time"
}
}

Or try this one which has more options: JSON To SQL Converter[^]
{
"id":999999,    
"name":"Johnson, Smith, and Jones Co.",    
"amount":123456.78,    
"Remark":"Pays on time"
}
 
Share this answer
 
v5
Comments
ahmed_sa 21-Sep-19 3:21am    
Are my json above is correct or what
ahmed_sa 21-Sep-19 3:46am    
this is not valid can you help me to be valid
ahmed_sa 21-Sep-19 4:12am    
see I modified json to be valid on main thread
ahmed_sa 21-Sep-19 4:20am    
Are json is suitable to my case or must change it please help me
ahmed_sa 21-Sep-19 5:26am    
are my json string wrong

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900