Retrieving String value of system.object basetype in PowershellSetting Windows PowerShell environment variablesDetermine installed PowerShell versionHow to run a PowerShell scriptPowerShell says “execution of scripts is disabled on this system.”How do you comment out code in PowerShell?How do I concatenate strings and variables in PowerShell?Create C# dll and use method with powershellChanging SerializationMethod of a workflowInvoke-Webrequest incorect Json format “Cannot bind parameter 'Headers' ”Powershell/XML saving returned value and multiple scripts

Unrecognized IC Package Style

Why isn't my calculation that we should be able to see the sun well beyond the observable universe valid?

What is this plant I saw for sale at a Romanian farmer's market?

Slow Performance When Changing Object Data [2.8]

What does this Swiss black on yellow rectangular traffic sign with a symbol looking like a dart mean?

Are there any individual aliens that have gained superpowers in the Marvel universe?

Large-n limit of the distribution of the normalized sum of Cauchy random variables

Understanding “en comprend”

How to make all magic-casting innate, but still rare?

What does it cost to buy a tavern?

Make symbols atomic, without losing their type

Is declining an undergraduate award which causes me discomfort appropriate?

Densest sphere packing

Print 'A' 1000 times with BrainFuck

Tznius concerns by a Sota

Implementation of the Jacobi Symbol in C

What is the highest power supply a Raspberry pi 3 B can handle without getting damaged?

Justifying Affordable Bespoke Spaceships

Boundaries and Buddhism

Is there any possible way to get these hearts as Adult Link?

Teferi's Time Twist and Gideon's Sacrifice

Summing cube roots in fractions

How much steel armor can you wear and still be able to swim?

"Prove that ∂A is closed given ∂A = Cl(A) − Int(A)"



Retrieving String value of system.object basetype in Powershell


Setting Windows PowerShell environment variablesDetermine installed PowerShell versionHow to run a PowerShell scriptPowerShell says “execution of scripts is disabled on this system.”How do you comment out code in PowerShell?How do I concatenate strings and variables in PowerShell?Create C# dll and use method with powershellChanging SerializationMethod of a workflowInvoke-Webrequest incorect Json format “Cannot bind parameter 'Headers' ”Powershell/XML saving returned value and multiple scripts






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have the result from the http post request and i am storing the content in a variabe.



$response = Invoke-WebRequest -Uri "https://xxxxxx" -Method Post -Body $Body -Headers $header 
$Content =$response.Content


Content looks like this:



"id":"246584121546545124545"


Now i want only the value of the id. i tried using the select object and property parameter to get the value of the id. But its not working as content is a string. Looks simple but couldn't find a way to retrieve the value.



PS C:Scripts> $Content.GetType()

IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True String System.Object









share|improve this question






























    0















    I have the result from the http post request and i am storing the content in a variabe.



    $response = Invoke-WebRequest -Uri "https://xxxxxx" -Method Post -Body $Body -Headers $header 
    $Content =$response.Content


    Content looks like this:



    "id":"246584121546545124545"


    Now i want only the value of the id. i tried using the select object and property parameter to get the value of the id. But its not working as content is a string. Looks simple but couldn't find a way to retrieve the value.



    PS C:Scripts> $Content.GetType()

    IsPublic IsSerial Name BaseType
    -------- -------- ---- --------
    True True String System.Object









    share|improve this question


























      0












      0








      0








      I have the result from the http post request and i am storing the content in a variabe.



      $response = Invoke-WebRequest -Uri "https://xxxxxx" -Method Post -Body $Body -Headers $header 
      $Content =$response.Content


      Content looks like this:



      "id":"246584121546545124545"


      Now i want only the value of the id. i tried using the select object and property parameter to get the value of the id. But its not working as content is a string. Looks simple but couldn't find a way to retrieve the value.



      PS C:Scripts> $Content.GetType()

      IsPublic IsSerial Name BaseType
      -------- -------- ---- --------
      True True String System.Object









      share|improve this question
















      I have the result from the http post request and i am storing the content in a variabe.



      $response = Invoke-WebRequest -Uri "https://xxxxxx" -Method Post -Body $Body -Headers $header 
      $Content =$response.Content


      Content looks like this:



      "id":"246584121546545124545"


      Now i want only the value of the id. i tried using the select object and property parameter to get the value of the id. But its not working as content is a string. Looks simple but couldn't find a way to retrieve the value.



      PS C:Scripts> $Content.GetType()

      IsPublic IsSerial Name BaseType
      -------- -------- ---- --------
      True True String System.Object






      powershell powershell-v5.0






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 25 at 6:30







      Harshith R

















      asked Mar 25 at 6:02









      Harshith RHarshith R

      347




      347






















          2 Answers
          2






          active

          oldest

          votes


















          1














          You can also use Invoke-RestMethod.



          $response = Invoke-RestMethod -Uri "https://xxxxxx" -Method Post -Body $Body -Headers $header 
          $response.id


          Invoke-RestMethod



          Microsoft Docs




          The Invoke-RestMethod cmdlet sends HTTP and HTTPS requests to Representational State Transfer (REST) web services that returns richly structured data.

          Windows PowerShell formats the response based to the data type.

          For JavaScript Object Notation (JSON) or XML, Windows PowerShell converts (or deserializes) the content into objects.







          share|improve this answer























          • This is a better solution IMO

            – shree.pat18
            Mar 25 at 6:46


















          1














          Try to parse from JSON to a custom PS object like so, and then access the id property:



          > $x = ConvertFrom-Json -InputObject $Content
          > $x.id





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332023%2fretrieving-string-value-of-system-object-basetype-in-powershell%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            You can also use Invoke-RestMethod.



            $response = Invoke-RestMethod -Uri "https://xxxxxx" -Method Post -Body $Body -Headers $header 
            $response.id


            Invoke-RestMethod



            Microsoft Docs




            The Invoke-RestMethod cmdlet sends HTTP and HTTPS requests to Representational State Transfer (REST) web services that returns richly structured data.

            Windows PowerShell formats the response based to the data type.

            For JavaScript Object Notation (JSON) or XML, Windows PowerShell converts (or deserializes) the content into objects.







            share|improve this answer























            • This is a better solution IMO

              – shree.pat18
              Mar 25 at 6:46















            1














            You can also use Invoke-RestMethod.



            $response = Invoke-RestMethod -Uri "https://xxxxxx" -Method Post -Body $Body -Headers $header 
            $response.id


            Invoke-RestMethod



            Microsoft Docs




            The Invoke-RestMethod cmdlet sends HTTP and HTTPS requests to Representational State Transfer (REST) web services that returns richly structured data.

            Windows PowerShell formats the response based to the data type.

            For JavaScript Object Notation (JSON) or XML, Windows PowerShell converts (or deserializes) the content into objects.







            share|improve this answer























            • This is a better solution IMO

              – shree.pat18
              Mar 25 at 6:46













            1












            1








            1







            You can also use Invoke-RestMethod.



            $response = Invoke-RestMethod -Uri "https://xxxxxx" -Method Post -Body $Body -Headers $header 
            $response.id


            Invoke-RestMethod



            Microsoft Docs




            The Invoke-RestMethod cmdlet sends HTTP and HTTPS requests to Representational State Transfer (REST) web services that returns richly structured data.

            Windows PowerShell formats the response based to the data type.

            For JavaScript Object Notation (JSON) or XML, Windows PowerShell converts (or deserializes) the content into objects.







            share|improve this answer













            You can also use Invoke-RestMethod.



            $response = Invoke-RestMethod -Uri "https://xxxxxx" -Method Post -Body $Body -Headers $header 
            $response.id


            Invoke-RestMethod



            Microsoft Docs




            The Invoke-RestMethod cmdlet sends HTTP and HTTPS requests to Representational State Transfer (REST) web services that returns richly structured data.

            Windows PowerShell formats the response based to the data type.

            For JavaScript Object Notation (JSON) or XML, Windows PowerShell converts (or deserializes) the content into objects.








            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 25 at 6:44









            rokumarurokumaru

            80339




            80339












            • This is a better solution IMO

              – shree.pat18
              Mar 25 at 6:46

















            • This is a better solution IMO

              – shree.pat18
              Mar 25 at 6:46
















            This is a better solution IMO

            – shree.pat18
            Mar 25 at 6:46





            This is a better solution IMO

            – shree.pat18
            Mar 25 at 6:46













            1














            Try to parse from JSON to a custom PS object like so, and then access the id property:



            > $x = ConvertFrom-Json -InputObject $Content
            > $x.id





            share|improve this answer



























              1














              Try to parse from JSON to a custom PS object like so, and then access the id property:



              > $x = ConvertFrom-Json -InputObject $Content
              > $x.id





              share|improve this answer

























                1












                1








                1







                Try to parse from JSON to a custom PS object like so, and then access the id property:



                > $x = ConvertFrom-Json -InputObject $Content
                > $x.id





                share|improve this answer













                Try to parse from JSON to a custom PS object like so, and then access the id property:



                > $x = ConvertFrom-Json -InputObject $Content
                > $x.id






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 25 at 6:37









                shree.pat18shree.pat18

                18.4k33352




                18.4k33352



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332023%2fretrieving-string-value-of-system-object-basetype-in-powershell%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript