Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
2 years ago
Solved

Hoe to get a value from JSON

Hi,   I need help in accessing a value in a JSON string.   I have a column called "ratings_and_unit_endorsements" which has the JASON strings. Here is an example: [{"expiry_date":"2023-11-29","r...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi ,

    Please try:

    List.Select(Json.Document([ratings_and_unit_endorsements]),(record) => record[unit] = [unit]){0}[expiry_date]


    All steps:

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wiq6OUUqtKMgsqoxPSSxJjVGyilEyMjAy1jU01DWyjFHSiVEqSizJzEsHyzi6eIKFSvMyS8ACrhGRkTFKtTp4TDE2wDAlIBjVFH/fiAi8phjpGhgSNMUnxN8faEqskg6YqRQbCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ratings_and_unit_endorsements = _t, unit = _t]),
        AddExpiryDate = Table.AddColumn(Source, "Expiry Date", each List.Select(Json.Document([ratings_and_unit_endorsements]),(record) => record[unit] = [unit]){0}[expiry_date])in
        AddExpiryDate

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum