Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Is there any simple way to get vorto value from a Json string?
The scenario I have is, I am using vorto with ArcheType, and in my view, I am getting ArcheTypeModel. now I can get vorto value as string from ArcheTypeModel, but cant find any way to convert this string into Vorto Model (or to fetch Vorto value out of that json string).
Better late than never I guess, but you could try this:
public static string ResolveVortoValue(this string rawValue, CultureInfo currentCulture)
vortoValue = JsonConvert.DeserializeObject<VortoValue>(rawValue);
//wasn't valid json for VortoValue
if (vortoValue == null) return rawValue;
if (!vortoValue.Values.TryGetValue(currentCulture.Name, out resolvedValue)) return rawValue; //no value for currentCulture, also possible to check for other cultures if you want
EDIT: maybe I should've mentioned that I haven't tested this code, but it should get you going if it wouldn't work after copy-paste ;-)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted