Please tell me. I can't solve the error in the JsonDocument.Parse method in any way.
Translation of the error text: Error CS1061 / "object" does not contain a definition for "Parse" and it was not possible to find an extension method "Parse" that takes the type "object" as the first argument (possibly missing a Using directive or an assembly reference).
Thanks in advance!
Translation of the error text: Error CS1061 / "object" does not contain a definition for "Parse" and it was not possible to find an extension method "Parse" that takes the type "object" as the first argument (possibly missing a Using directive or an assembly reference).
Thanks in advance!
Code:
using Leaf.xNet;
using System;
using System.IO;
using System.Threading;
using System.Text.Json;
namespace ConsoleApplication1
{
class Checker
{
static object fileLocker = new object();
public static object JsonDocument { get; private set; }
static string getWumpCode(string res)
{
JsonElement json = JsonDocument.Parse(res).RootElement;
JsonElement store_listing = json.GetProperty("store_listing");
JsonElement sku = store_listing.GetProperty("sku");
JsonElement code_property = json.GetProperty("code");
JsonElement redeemed_property = json.GetProperty("redeemed");
JsonElement name_property = sku.GetProperty("name");
bool redeemed = redeemed_property.GetBoolean();
string redeemed_info = redeemed ? "(Redeemed)" : "";
string code = code_property.GetString();
string name = name_property.GetString();
return $"{code} - {name} {redeemed_info}";
}
}
}
Attachments
Last edited: