Does HttpService:JSONEncode() have a max string length?

I’m using JSONEncode to convert an extremely long table to a string. However recently I had a server crash and the JSON saved as a blank and I feel like I may have hit a threshold on JSONEncode.

Does anyone have any information on this?

I don’t know what you’re using it for or how much is “an extremely long table” but in Homebuilder 2 I’ve encoded JSON strings that ended up at 547,887 characters long (almost double the limit of datastore keys), and then compressed them down using LZW (see this thread). I’ve had zero issues in that game with any sort of crashing and without hitting a JSONEncode max string length

2 Likes

It shouldn’t have a limit. If it did, I would consider that a bug. But I guess there’s always memory limitations. Maybe I’ll try to break it.

2 Likes

Looks like Roblox crashes when you try to store exactly 200,000 characters in a string value, which is misleading as the wiki says 200k is it’s cap. 199,999 works perfectly fine.

1 Like

But a raw string value seems to have no limit. For instance, I executed this code just fine:

local s = ("a"):rep(1000000000)
print("Done")

To put that into words, that’s the letter ‘a’ 1 billion times (American billion). I would be doubtful that your JSON string is every going to exceed that many characters lol

2 Likes

HttpsService doesn’t have a max string length, however, depending on what the string is, ROBLOX may crash, maybe it has something to do with the String you tried entering in. :heart: