All community
This category
This board
Knowledge base
Users
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Show
only
|
Search instead for
Did you mean:
Exit
Global community
Language:
Deutsch
English
Español
Français
Português
日本語コミュニティ
Dedicated community for Japanese speakers
한국 커뮤니티
Dedicated community for Korean speakers
Sign In
Home
ColdFusion
Discussions
How to read and write the data like this(is JSON?)...
Home
ColdFusion
Discussions
How to read and write the data like this(is JSON?)...
0
Upvote
How to read and write the data like this(is JSON?)?
Flashcqxg
New Here
,
/t5/coldfusion-discussions/how-to-read-and-write-the-data-like-this-is-json/td-p/172619
Sep 24, 2008
Sep 24, 2008
Copy link to clipboard
Copied
i have some data like below(is json?),how to write them into the database?
i user coldfusion 7.
[
{"title":"ColdFusion?","url":"
http://www.adobe.com/cfusion/"},
{"title":"flex blogs","url":"
http://www.flexblogs.com/"},
{"title":"studio","url":"
http://www.sans.com.com/"}
]
Thank you very much!
Views
518
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Dan_Bracuk
LEGEND
,
Sep 24, 2008
Sep 24, 2008
Dan_Bracuk
•
LEGEND
,
Sep 24, 2008
Sep 24, 2008
You have nested lists. The delimiters are different in each case.
Google "coldfusion list functions" for ways to approach this.
In this specific case, you will have to create variables to use as delimters, such as
delimiterA = '","';
That's double quote, comma, double quote, by the way, since it's probably hard to read.
Votes
0
Upvote
Translate
Translate
Jump to answer
5 Replies
5
Jump to latest reply
Dan_Bracuk
LEGEND
,
/t5/coldfusion-discussions/how-to-read-and-write-the-data-like-this-is-json/m-p/172620#M15677
Sep 24, 2008
Sep 24, 2008
Copy link to clipboard
Copied
What are the fields in your db, and for the first record, which values do you want to go in each field?
Also, are the square brackets something you have to contend with, or did you just put them there?
Finally, does the data really have carraige returns after each record, or just the commas?
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Stressed_Simon
Engaged
,
/t5/coldfusion-discussions/how-to-read-and-write-the-data-like-this-is-json/m-p/172621#M15678
Sep 24, 2008
Sep 24, 2008
Copy link to clipboard
Copied
You need to parse it and then insert the records into your database.
Take a look at
CFJSON
it is a JSON serialiser and de-serialiser.
Once you have converted it to native CF datatypes you can loop through it and insert it into your database.
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Flashcqxg
AUTHOR
New Here
,
/t5/coldfusion-discussions/how-to-read-and-write-the-data-like-this-is-json/m-p/172622#M15679
Sep 24, 2008
Sep 24, 2008
Copy link to clipboard
Copied
Thank you,Dan Bracuk and Stressed_Simon .
the "title" and "url" are the fieldname in my database.
I had a look at CFJSON,but mine is not JSON formated.
the square brackets something is the contend i want to insert or update in the database.
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Correct answer by
Dan_Bracuk
LEGEND
,
/t5/coldfusion-discussions/how-to-read-and-write-the-data-like-this-is-json/m-p/172623#M15680
Sep 24, 2008
Sep 24, 2008
Copy link to clipboard
Copied
You have nested lists. The delimiters are different in each case.
Google "coldfusion list functions" for ways to approach this.
In this specific case, you will have to create variables to use as delimters, such as
delimiterA = '","';
That's double quote, comma, double quote, by the way, since it's probably hard to read.
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Flashcqxg
AUTHOR
New Here
,
/t5/coldfusion-discussions/how-to-read-and-write-the-data-like-this-is-json/m-p/172624#M15681
Sep 25, 2008
Sep 25, 2008
Copy link to clipboard
Copied
LATEST
Thanks.
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Post Reply
Preview
Exit Preview
never-displayed
You must be signed in to add attachments
never-displayed
Resources
Documentation
ColdFusion User Guide