I’m trying to translate a richtext value in a blockgrid via google translate API. It is causing an issue when I save the translated result to the bodyText property with method content.SetValue(propertyAlias, value, culture, segment). Umbraco won’t set the value coming from the translator. Not sure if I need to remove stuff like the following before sending to the translator: \u0022markup\u0022:\u0022\\u003 \\u003C/h3\\u003E\u0022,\u0022blocks\u0022:{\u0022contentData\u0022:,\u0022settingsData\u0022:,\u0022expose\u0022:,\u0022Layout\u0022:{}}}
I tried HTML aglity pack innerhtml before sending the html to the translator and then using HTMLDecode on the translated result. This didn’t fix the issue. Any help would be appreciated.
Umbraco is logging the following error:
System.Text.Json.JsonException: '/' is invalid after a value. Expected either ',', '}', or ']'. Path: $ | LineNumber: 0 | BytePositionInLine: 25.
---> System.Text.Json.JsonReaderException: '/' is invalid after a value. Expected either ',', '}', or ']'. LineNumber: 0 | BytePositionInLine: 25.
at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
at System.Text.Json.Utf8JsonReader.ConsumeNextToken(Byte marker)
at System.Text.Json.Utf8JsonReader.ConsumeNextTokenOrRollback(Byte marker)
at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
at Umbraco.Cms.Infrastructure.Serialization.SystemTextJsonSerializerBase.Deserialize[T](String input)
at Umbraco.Cms.Core.PropertyEditors.RichTextPropertyEditorHelper.TryParseRichTextEditorValue(Object value, IJsonSerializer jsonSerializer, ILogger logger, RichTextEditorValue& richTextEditorValue)