Export to GitHub

aspjson - issue #26

double quotation mark missing when using QueryToJSON


Posted on Aug 25, 2012 by Swift Elephant

What steps will reproduce the problem?

  1. executing : QueryToJSON(dbconn, "SELECT name, surname FROM members WHERE age < 30").Flush

into an asp page

my own select is actually : Select CategoryID as id, Description as value from Categories WHERE Description Like '%a%'

What is the expected output? What do you see instead? The json data generated is : [{"id":1,"value":"Soft drinks, coffees, teas, beers, and ales"},{"id":2,"value":"Sweet and savory sauces, relishes, spreads, and seasonings"},{"id":3,"value":"Desserts, candies, and sweet breads"},{"id":5,"value":"Breads, crackers, pasta, and cereal"},{"id":6,"value":"Prepared meats"},{"id":7,"value":"Dried fruit and bean curd"},{"id":8,"value":"Seaweed and fish"}]

The value of id is 1 instead of "1" the double quotation mark is missing What version of the product are you using? On what operating system?

<!--#INCLUDE VIRTUAL="includes/JSON_2.0.4.asp"--> <!--#INCLUDE VIRTUAL="includes/JSON_UTIL_0.1.1.asp"-->

Please provide any additional information below.

see source3.asp attached the script use the database is sample database 'Northwind' provided by ms-sql 2k

delaunay@free.fr

Comment #1

Posted on Sep 10, 2012 by Quick Monkey

Typically, the id in a record is usually an number (often integer, auto increment).
Numbers are not typically wrapped in quotes. Please reference http://www.json.org/

Comment #2

Posted on Sep 10, 2012 by Helpful Panda

(No comment was entered for this change.)

Status: Duplicate

Labels:
Type-Defect Priority-Medium