Forum Discussion

bottos's avatar
bottos
Frequent Visitor
2 years ago
Solved

Trouble converting list into text (JSON and Azure Cognitive Services)

Hi. I am not sure what I am doing wrong, so any help will be greatly appreciated. I am using the Azure Cognitive Services to translate a column with text. To do that, I have created a function as fo...
  • lbendlin's avatar
    2 years ago

    seems to work ok?

     

    let
        Source = Json.Document("[
    {
    ""translations"": [
    {
    ""text"": ""Sequência de teste 1"",
    ""to"": ""pt""
    }
    ]
    },
    {
    ""translations"": [
    {
    ""text"": ""Sequência de teste 2 "",
    ""to"": ""pt""
    }
    ]
    }
    ]"),
        #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
        #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"translations"}, {"translations"}),
        #"Expanded translations" = Table.ExpandListColumn(#"Expanded Column1", "translations"),
        #"Expanded translations1" = Table.ExpandRecordColumn(#"Expanded translations", "translations", {"text", "to"}, {"text", "to"})
    in
        #"Expanded translations1"