<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to parse single line JSON and XML via Power Query? in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/How-to-parse-single-line-JSON-and-XML-via-Power-Query/m-p/3761636#M123783</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following flattened (in a single line) JSON:&lt;/P&gt;&lt;P&gt;{"credentials":{"personalAccessTokenName":"MY_TOKEN_NAME","personalAccessTokenSecret":"qlE1g9MMh9vbrjjg==:rZTHhPpP2tUW1kfn4tjg8","site":{"contentUrl":"MarketingTeam"}}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also have the following flattened (in a single line) XML:&lt;/P&gt;&lt;P&gt;&amp;lt;tsRequest&amp;gt;&amp;lt;credentials personalAccessTokenName="MY_TOKEN_NAME" personalAccessTokenSecret="qlE1g9MMh9vbrjjg==:rZTHhPpP2tUW1kfn4tjg8"&amp;gt;&amp;lt;site contentUrl="MarketingTeam"/&amp;gt;&amp;lt;/credentials&amp;gt;&amp;lt;/tsRequest&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you provide a sample Power Query how to convert these into JSON and XML documents that can be further queried via Power Query?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the below but it does not seem to be able to parse it correctly:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Json.FromValue("{""credentials"":{""personalAccessTokenName"":""MY_TOKEN_NAME"",""personalAccessTokenSecret"":""qlE1g9MMh9vbrjjg==:rZTHhPpP2tUW1kfn4tjg8"",""site"":{""contentUrl"":""MarketingTeam""}}}")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, there seems there is no similar command for XML.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 13 Mar 2024 20:16:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-03-13T20:16:38Z</dc:date>
    <item>
      <title>How to parse single line JSON and XML via Power Query?</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/How-to-parse-single-line-JSON-and-XML-via-Power-Query/m-p/3761636#M123783</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following flattened (in a single line) JSON:&lt;/P&gt;&lt;P&gt;{"credentials":{"personalAccessTokenName":"MY_TOKEN_NAME","personalAccessTokenSecret":"qlE1g9MMh9vbrjjg==:rZTHhPpP2tUW1kfn4tjg8","site":{"contentUrl":"MarketingTeam"}}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also have the following flattened (in a single line) XML:&lt;/P&gt;&lt;P&gt;&amp;lt;tsRequest&amp;gt;&amp;lt;credentials personalAccessTokenName="MY_TOKEN_NAME" personalAccessTokenSecret="qlE1g9MMh9vbrjjg==:rZTHhPpP2tUW1kfn4tjg8"&amp;gt;&amp;lt;site contentUrl="MarketingTeam"/&amp;gt;&amp;lt;/credentials&amp;gt;&amp;lt;/tsRequest&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you provide a sample Power Query how to convert these into JSON and XML documents that can be further queried via Power Query?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the below but it does not seem to be able to parse it correctly:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Json.FromValue("{""credentials"":{""personalAccessTokenName"":""MY_TOKEN_NAME"",""personalAccessTokenSecret"":""qlE1g9MMh9vbrjjg==:rZTHhPpP2tUW1kfn4tjg8"",""site"":{""contentUrl"":""MarketingTeam""}}}")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, there seems there is no similar command for XML.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 20:16:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/How-to-parse-single-line-JSON-and-XML-via-Power-Query/m-p/3761636#M123783</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-13T20:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse single line JSON and XML via Power Query?</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/How-to-parse-single-line-JSON-and-XML-via-Power-Query/m-p/3761893#M123800</link>
      <description>&lt;LI-CODE lang="markup"&gt;let
    Source = Json.Document("{""credentials"":{""personalAccessTokenName"":""MY_TOKEN_NAME"",""personalAccessTokenSecret"":""qlE1g9MMh9vbrjjg==:rZTHhPpP2tUW1kfn4tjg8"",""site"":{""contentUrl"":""MarketingTeam""}}}"),
    #"Converted to Table1" = Record.ToTable(Source),
    #"Expanded Value" = Table.ExpandRecordColumn(#"Converted to Table1", "Value", {"personalAccessTokenName", "personalAccessTokenSecret", "site"}, {"personalAccessTokenName", "personalAccessTokenSecret", "site"}),
    #"Expanded site" = Table.ExpandRecordColumn(#"Expanded Value", "site", {"contentUrl"}, {"contentUrl"})
in
    #"Expanded site"&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = Xml.Document("&amp;lt;tsRequest&amp;gt;&amp;lt;credentials personalAccessTokenName=""MY_TOKEN_NAME"" personalAccessTokenSecret=""qlE1g9MMh9vbrjjg==:rZTHhPpP2tUW1kfn4tjg8""&amp;gt;&amp;lt;site contentUrl=""MarketingTeam""/&amp;gt;&amp;lt;/credentials&amp;gt;&amp;lt;/tsRequest&amp;gt;"),
    #"Expanded Value" = Table.ExpandTableColumn(Source, "Value", {"Name", "Value"}, {"Name.1", "Value.1"}),
    #"Expanded Value.1" = Table.ExpandTableColumn(#"Expanded Value", "Value.1", {"Name", "Value"}, {"Name.2", "Value"}),
    #"Expanded Value1" = Table.ExpandTableColumn(#"Expanded Value.1", "Value", {"Name", "Value"}, {"Name.3", "Value.1"})
in
    #"Expanded Value1"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 14 Mar 2024 00:49:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/How-to-parse-single-line-JSON-and-XML-via-Power-Query/m-p/3761893#M123800</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-14T00:49:02Z</dc:date>
    </item>
  </channel>
</rss>

