How to extract json from a relational db?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fred Wallace
    New Member
    • Nov 2013
    • 1

    How to extract json from a relational db?

    I don’t like writing a lot of procedural code, and so I’d like to know a common way to extract data from relational tables and move it into hierarchical json.

    Right now, I am using MS SQL Server database, but I would like to perform this migration using My SQL database also.

    I am using java and java connectivity database for access. I’d prefer any of these two databases to be able to assemble all the records on the server side.
  • David Townsend
    New Member
    • Nov 2013
    • 4

    #2
    Hi,

    First of all, SQL Server itself doesn’t support json, so you’ll need to figure out your own way if you want to accomplish this.

    To help you, I’ve found a good post illustrating a number of string manipulation techniques in TSQL:
    It has always seemed strange to Phil that SQL Server has such complete support for XML, yet is completely devoid of any support for JSON. In the end, he was forced, by a website project, into doing something about it. The result is this article, an iconoclastic romp around the representation of hierarchical structures, and some code to get you started.

    Comment

    Working...