local w=require((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\078\101\118\101\114\109\111\114\101"))local z=game:GetService("\072\116\116\112\083\101\114\118\105\099\101")local g=w("\080\114\111\109\105\115\101")local H={}function H.PromiseJSONDecode(w)if type(w)~="\115\116\114\105\110\103"then return g.rejected(w)end return g.new(function(g,H)local C local x,Q=pcall(function()C=z:JSONDecode(w)end)if not x then H(Q)return elseif C then g(C)return else H("\070\097\105\108\101\100 \116\111 \100\101\099\111\100\101 \097\110\121 \118\097\108\117\101")return end end)end return H
--- Utility methods for JSON
-- @module JSONUtils

local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))

local HttpService = game:GetService("HttpService")

local Promise = require("Promise")

local JSONUtils = {}

function JSONUtils.PromiseJSONDecode(str)
	if type(str) ~= "string" then
		return Promise.rejected(str)
	end

	return Promise.new(function(resolve, reject)
		local decoded
		local ok, err = pcall(function()
			decoded = HttpService:JSONDecode(str)
		end)

		if not ok then
			reject(err)
			return
		elseif decoded then
			resolve(decoded)
			return
		else
			reject("Failed to decode any value")
			return
		end
	end)
end

return JSONUtils