• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

DeserializeJSON - is there a limit on the size of the JSON data that can be converted?

Guest
Feb 21, 2014 Feb 21, 2014

Copy link to clipboard

Copied

I have some valid JSON data that's being converted successfully by DeserializeJSON... until it gets to a certain size, or that's certainly what appears to be happening.  The breaking point seems to be somewhere in the neighborhood of 35,000 characters... about 35KB.  When the conversion fails, it fails with a "JSON parsing failure: Unexpected end of JSON string" message.  And when the conversion fails, the JSON data is deemed to be valid per tools like this one:  http://www.freeformatter.com/json-validator.html.

So, is there a limit on the size of the JSON data that can be converted by DeserializeJSON?

Thanks!

Views

2.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Feb 21, 2014 Feb 21, 2014

Thanks Carl.

The JSON is being submitted in its entirety, confirmed by Fiddler.  And it's actually being successfully saved to a SQL Server nvarchar(MAX) field too.  I can validate that saved JSON.

I'm actually grabbing the JSON to convert directly from the SQL Server, and your comments / thoughts led me down the path of resolution.

Turns out that the JSON was being truncated prior to getting to the DeserializeJSON command, but it was the cfquery pull that was doing the truncating.  The fix was to

...

Votes

Translate

Translate
Guide ,
Feb 21, 2014 Feb 21, 2014

Copy link to clipboard

Copied

Is it possible that the POST size exceeds what is set in the "Maximum size of post data" setting in CFAdmin (not likely as I think it defaults to 20MB or something like that)?  Is the JSON being submitted using POST or GET (GET uses URL parameters and there is a limit to how big a GET request can be)? Or maybe the web server (IIS or Apache) is truncating the data?

Have you checked the JSON being transmitted via Developer Tools or a tool like FIddle or Charles?  Is it being truncated before it even gets to ColdFusion?

-Carl V.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 21, 2014 Feb 21, 2014

Copy link to clipboard

Copied

Thanks Carl.

The JSON is being submitted in its entirety, confirmed by Fiddler.  And it's actually being successfully saved to a SQL Server nvarchar(MAX) field too.  I can validate that saved JSON.

I'm actually grabbing the JSON to convert directly from the SQL Server, and your comments / thoughts led me down the path of resolution.

Turns out that the JSON was being truncated prior to getting to the DeserializeJSON command, but it was the cfquery pull that was doing the truncating.  The fix was to enable "long text retrieval (CLOB)" for this datasource in CF Admin.  I'd never run into that before or even knew that this setting existed.

Thanks again for your comments!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 21, 2014 Feb 21, 2014

Copy link to clipboard

Copied

Glad you got that sorted.  CLOB issues eventually bite most of us at some point.

-Carl V.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 22, 2014 Feb 22, 2014

Copy link to clipboard

Copied

@Redherring917

What a rare finding: a practical application of one of the esoteric settings. Please kindly mark your response as the correct answer. It will surely help someone else in future.

@Carl Von Stetten

Say what! CLOB issues eventually byte most of us at some point!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 24, 2014 Feb 24, 2014

Copy link to clipboard

Copied

LATEST

@BKBK,

I see what you did there.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation