Decoding (with HttpService) launchdata that you get from deeplinked URLs will return half of the string (or the beginning of the string) and/or returns “Cannot be parsed JSON”;
Demo code for an example;
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function (plr)
local launchData = plr:GetJoinData().LaunchData
print(launchData)
print(HttpService:JSONDecode(launchData))
end)
Examples of it happening:
Cannot parse to JSON" error or returns just {"id :
Thanks for the report. Just to clarify: are you seeing this from anywhere other than Windows clients? This sounds a lot like an issue we’ve seen, and don’t have a fix for, where Windows automatically URL decodes the link before giving it to us on the command line, resulting in quotation marks being stripped out and spaces messing up our parsing(in your example, that’d explain the missing “ after id and the rest of it being missing since there’s that space after the colon). Have you tried using a Base64 encoding rather than normal URL encoding?
Thanks, can you provide a Base64 version that doesn’t work? If we can reproduce it locally, that’ll help a lot in terms of fixing the issue. URL encoded JSON on Windows is, unfortunately just something we don’t have much of a way to fix right now.
With Base64 Encoding: https://www.roblox.com/games/start?launchData=W3siaWQiOiAic3Nzc2EifSx7Imh1YiI6ICJzc3NzIn1d&placeId=17408110728 https://i.imgur.com/SJXW47J.png
Ahhh, ok. Looking at the Base64 result, it looks like your scripts are getting the full string you passed in, but it’s just still encoded so isn’t valid JSON. We don’t automatically decode those, so that’s something you’d need to do in your script. Poking around, there are some community resources that can help to do that(https://create.roblox.com/store/asset/11436058206/Base64?externalSource=www or for a simple function to copy/paste into your code: Base64 Encoding and Decoding in Lua) and I expect that once you decode it, it should work well.
Yep, it works well! I guess that’s the problem, I should open up a feature request for a function for encoding/decoding in Base64s. Thank you for your help!
Are there any plans to do this with Roblox encoding/decoding these links?
I don’t think we have plans along those lines; for right now Base64 encoding is more of a workaround. But we are looking at ways to try to generally get around this issue of Windows breaking the URL-encoded data. And we’ll definitely post an update when we figure out something better.