{"id":56478,"date":"2023-01-23T20:11:07","date_gmt":"2023-01-23T14:41:07","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=56478"},"modified":"2024-01-02T17:41:54","modified_gmt":"2024-01-02T12:11:54","slug":"go-pointers-lets-talk-about-it","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/go-pointers-lets-talk-about-it\/","title":{"rendered":"Go Pointers! Let\u2019s talk about it\u2026"},"content":{"rendered":"<p><img decoding=\"async\" loading=\"lazy\" class=\"\" src=\"\/blog\/wp-ttn-blog\/uploads\/2024\/01\/0wth8hnFT-ae0tQoe.jpg\" width=\"829\" height=\"466\" \/><\/p>\n<p id=\"ef3f\" class=\"pw-post-body-paragraph acz ada abt rc b adb adc vs add ade adf vv adg adh adi adj adk adl adm adn ado adp adq adr ads adt oe bx adu\" data-selectable-paragraph=\"\">A <strong class=\"rc mw\">pointer<\/strong>, as name suggests, is a variable that points to a location in the memory of your system where a value is stored rather than a value itself. Basically, it is an address to the value stored in memory. The definition is simple but this concept can be a little tricky to wrap your head around.<\/p>\n<p id=\"019f\" class=\"pw-post-body-paragraph acz ada abt rc b adb adc vs add ade adf vv adg adh adi adj adk adl adm adn ado adp adq adr ads adt oe bx\" data-selectable-paragraph=\"\">When I first developed a good understanding of pointers in Go, I asked myself, \u201cHow can I explain this concept to a 5-year-old?\u201d Well, I don\u2019t know if I can find words to explain this to a 5 year old, but I will still attempt to give you a simplistic and comprehensive understanding.<\/p>\n<p id=\"dbdb\" class=\"pw-post-body-paragraph acz ada abt rc b adb adc vs add ade adf vv adg adh adi adj adk adl adm adn ado adp adq adr ads adt oe bx\" data-selectable-paragraph=\"\">Let\u2019s write a small piece of code:<\/p>\n<pre><span class=\"hljs-keyword\">package<\/span> main\r\n\r\n<span class=\"hljs-keyword\">import<\/span> <span class=\"hljs-string\">\"fmt\"<\/span>\r\n\r\n<span class=\"hljs-keyword\">type<\/span> animal <span class=\"hljs-keyword\">struct<\/span> {\r\nname <span class=\"hljs-type\">string<\/span>\r\nsound <span class=\"hljs-type\">string<\/span>\r\n}\r\n\r\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">func<\/span> <span class=\"hljs-title\">main<\/span><span class=\"hljs-params\">()<\/span><\/span> {\r\nmyAnimal := animal{\r\nname: <span class=\"hljs-string\">\"Cat\"<\/span>,\r\nsound: <span class=\"hljs-string\">\"Meeeaaawwwwww\"<\/span>,\r\n}\r\n\r\nmyAnimal.updateAttributes(<span class=\"hljs-string\">\"Cow\"<\/span>, <span class=\"hljs-string\">\"Mooooooooo\"<\/span>)\r\n\r\nmyAnimal.<span class=\"hljs-built_in\">print<\/span>(<span class=\"hljs-string\">\"Updated Structure\"<\/span>)\r\n}\r\n\r\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">func<\/span> <span class=\"hljs-params\">(p animal)<\/span><\/span> updateAttributes(newName <span class=\"hljs-type\">string<\/span>, sound <span class=\"hljs-type\">string<\/span>) {\r\np.name = newName\r\np.sound = sound\r\n}\r\n\r\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">func<\/span> <span class=\"hljs-params\">(p animal)<\/span><\/span> <span class=\"hljs-built_in\">print<\/span>(text <span class=\"hljs-type\">string<\/span>) {\r\nresult := fmt.Sprintf(<span class=\"hljs-string\">\"%s ==&gt; %+v \\n \\n\"<\/span>, text, p)\r\nfmt.Printf(<span class=\"hljs-string\">\"%+v\"<\/span>, result)\r\n}<\/pre>\n<p id=\"18c5\" class=\"pw-post-body-paragraph acz ada abt rc b adb adc vs add ade adf vv adg adh adi adj adk adl adm adn ado adp adq adr ads adt oe bx\" data-selectable-paragraph=\"\">Let\u2019s break this down:<\/p>\n<ol class=\"\">\n<li id=\"38f6\" class=\"aer aes abt rc b adb adc ade adf adh aet adl aeu adp aev adt aew aex aey dz bx\" data-selectable-paragraph=\"\">We are creating an animal,\u00a0<code class=\"em aez afa afb aei b\">cat<\/code>\u00a0which has attributes defined in type\u00a0<code class=\"em aez afa afb aei b\">animal<\/code>\u00a0.<\/li>\n<li id=\"99d8\" class=\"aer aes abt rc b adb afc ade afd adh afe adl aff adp afg adt aew aex aey dz bx\" data-selectable-paragraph=\"\">Now, I want to update\u00a0<code class=\"em aez afa afb aei b\">myAnimal<\/code>\u00a0from a\u00a0<code class=\"em aez afa afb aei b\">cat<\/code>\u00a0to a\u00a0<code class=\"em aez afa afb aei b\">cow<\/code>. To do so, I am calling my receiver function\u00a0<code class=\"em aez afa afb aei b\">cat.updateAttributes(\"cow\", \"mooooooooo\")<\/code>\u00a0to update the attributes\u00a0<code class=\"em aez afa afb aei b\">name<\/code>\u00a0and\u00a0<code class=\"em aez afa afb aei b\">sound<\/code>\u00a0.<\/li>\n<li id=\"0048\" class=\"aer aes abt rc b adb afc ade afd adh afe adl aff adp afg adt aew aex aey dz bx\" data-selectable-paragraph=\"\">Finally, I have invoked another receiver function\u00a0<code class=\"em aez afa afb aei b\">print<\/code>\u00a0to print my updated animal.<\/li>\n<\/ol>\n<p>Let\u2019s run our go module using\u00a0<code class=\"em aez afa afb aei b\">go run .<\/code>:<\/p>\n<pre>\/\/Output:\r\n\r\nUpdated Structure ==&gt; {\r\nname:Cat \r\nsound:Meeeaaawwwwww \r\nzooInfo:{\r\ntown:California \r\nemail:abc@xyz.com \r\npinCode:12345\r\n\u00a0 }\r\n}<\/pre>\n<p>Wooops\u2026 as you can see, my animal is still a <code class=\"em aez afa afb aei b\">cat<\/code>.<\/p>\n<p>Let\u2019s see what gets printed inside the receiver function:<\/p>\n<pre><span class=\"hljs-function\"><span class=\"hljs-keyword\">func<\/span> <span class=\"hljs-params\">(p animal)<\/span><\/span> updateAttributes(newName <span class=\"hljs-type\">string<\/span>, sound <span class=\"hljs-type\">string<\/span>) {\r\np.name = newName\r\np.sound = sound\r\n\r\n<span class=\"hljs-comment\">\/\/ Let's call the print command here!<\/span>\r\np.<span class=\"hljs-built_in\">print<\/span>(<span class=\"hljs-string\">\"Tadaaa\"<\/span>)\r\n}\r\n\r\n<span class=\"hljs-comment\">\/\/Output<\/span>\r\nTadaaaa ==&gt; {\r\nname:cow \r\nsound:Mooooooooo \r\n}<\/pre>\n<h3 id=\"722a\" class=\"afi aem abt bu wm qc afj qd qg qh afk qi ql adh afl afm qq adl afn afo qv adp afp afq ra afr bx\"><strong>Here is what happens in the background:<\/strong><\/h3>\n<p><img decoding=\"async\" src=\"\/blog\/wp-ttn-blog\/uploads\/2024\/01\/15SgbMidc7eoVXgOtr1aXZA.png\" \/><\/p>\n<p>In nutshell, Go creates an entirely new\u00a0<code class=\"em aez afa afb aei b\">struct<\/code>\u00a0when a\u00a0<code class=\"em aez afa afb aei b\">myAnimal<\/code>\u00a0is passed from one function to another and\u00a0<code class=\"em aez afa afb aei b\">p<\/code>\u00a0, the receiver function argument becomes a new\u00a0<code class=\"em aez afa afb aei b\">struct<\/code>\u00a0altogether.<\/p>\n<blockquote><p><em>In other words,\u00a0<code class=\"em aez afa afb aei b\">p<\/code>\u00a0has its value stored in a different memory location than\u00a0<code class=\"em aez afa afb aei b\">myAnimal<\/code>\u00a0.<\/em><\/p><\/blockquote>\n<p>For making changes in the original\u00a0<code class=\"em aez afa afb aei b\">struct<\/code>\u00a0, we can use\u00a0<code class=\"em aez afa afb aei b\">*<\/code>\u00a0and\u00a0<code class=\"em aez afa afb aei b\">&amp;<\/code>\u00a0operators.<\/p>\n<h2 id=\"cb2e\" class=\"aga aem abt bu wm agb agc agd qg age agf agg ql qm agh qn qq qr agi qs qv qw agj qx ra agk bx\"><strong>The \u2018*\u2019 and \u2018&amp;\u2019 operator<\/strong><\/h2>\n<p>Let\u2019s modify our main function and receiver function updateAttributes a bit:<\/p>\n<pre><span class=\"hljs-function\"><span class=\"hljs-keyword\">func<\/span> <span class=\"hljs-title\">main<\/span><span class=\"hljs-params\">()<\/span><\/span> {\r\nmyAnimal := animal{\r\nname: <span class=\"hljs-string\">\"Cat\"<\/span>,\r\nsound: <span class=\"hljs-string\">\"Meeeaaawwwwww\"<\/span>,\r\n}\r\n\r\n<span class=\"hljs-comment\">\/\/STEP#1. Print the original struct myAnimal<\/span>\r\nmyAnimal.<span class=\"hljs-built_in\">print<\/span>(<span class=\"hljs-string\">\"Original Structure\"<\/span>)\r\n\r\n<span class=\"hljs-comment\">\/\/STEP#2. Create a pointer<\/span>\r\nmyAnimalPointer := &amp;myAnimal\r\n\r\n<span class=\"hljs-comment\">\/\/STEP#3. myAnimalPointer will still have access<\/span>\r\n<span class=\"hljs-comment\">\/\/to receiver functions of myAnimal.<\/span>\r\n<span class=\"hljs-comment\">\/\/So let's update myAnimalPointer value attributes<\/span>\r\nmyAnimalPointer.updateAttributes(<span class=\"hljs-string\">\"Dog\"<\/span>, <span class=\"hljs-string\">\"Woof Woof Woof\"<\/span>)\r\n\r\n<span class=\"hljs-comment\">\/\/STEP#4. Print the myAnimal values and see if the <\/span>\r\n<span class=\"hljs-comment\">\/\/original struct values changed<\/span>\r\nmyAnimal.<span class=\"hljs-built_in\">print<\/span>(<span class=\"hljs-string\">\"Updated Struct\"<\/span>)\r\n}\r\n\r\n<span class=\"hljs-comment\">\/\/STEP#3.1: We'll access the value attributes using * operator <\/span>\r\n<span class=\"hljs-comment\">\/\/and make the changes in the orginal struct value<\/span>\r\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">func<\/span> <span class=\"hljs-params\">(p *animal)<\/span><\/span> updateAttributes(newName <span class=\"hljs-type\">string<\/span>, sound <span class=\"hljs-type\">string<\/span>) {\r\n(*p).name = newName\r\n(*p).sound = sound\r\n}<\/pre>\n<h3 id=\"2e26\" class=\"afi aem abt bu wm qc afj qd qg qh afk qi ql adh afl afm qq adl afn afo qv adp afp afq ra afr bx\"><strong>Let\u2019s talk about \u201cmain\u201d function: Creation of a pointer<\/strong><\/h3>\n<pre>myAnimal := animal{\r\nname: <span class=\"hljs-string\">\"Cat\"<\/span>,\r\nsound: <span class=\"hljs-string\">\"Meeeaaawwwwww\"<\/span>\r\n}\r\n\r\nmyAnimalPointer := &amp;myAnimal\r\nmyAnimalPointer.<span class=\"hljs-built_in\">updateAttributes<\/span>(<span class=\"hljs-string\">\"Dog\"<\/span>, <span class=\"hljs-string\">\"Woof Woof Woof\"<\/span>)\r\n\r\n\/\/OR We can simply do something like \r\n(&amp;myAnimal).<span class=\"hljs-built_in\">updateAttributes<\/span>(<span class=\"hljs-string\">\"Dog\"<\/span>, <span class=\"hljs-string\">\"Woof Woof Woof\"<\/span>) \/\/Same thing!\r\n\r\nmyAnimal.<span class=\"hljs-built_in\">print<\/span>(<span class=\"hljs-string\">\"Updated Struct\"<\/span>)\r\n}<\/pre>\n<p>Using the\u00a0<code class=\"em aez afa afb aei b\">&amp;<\/code>operator, we can create a pointer and we can get the address in memory where the value of the\u00a0<code class=\"em aez afa afb aei b\">myAnimal<\/code>\u00a0is stored. We have assigned\u00a0<code class=\"em aez afa afb aei b\">&amp;myAnimal<\/code>\u00a0pointer to\u00a0<code class=\"em aez afa afb aei b\">myAnimalPointer<\/code>\u00a0variable.<\/p>\n<h3 id=\"d547\" class=\"afi aem abt bu wm qc afj qd qg qh afk qi ql adh afl afm qq adl afn afo qv adp afp afq ra afr bx\"><strong>Let\u2019s talk about the receiver function \u201cupdateAttributes\u201d : Retrieving value from the pointer<\/strong><\/h3>\n<pre><span class=\"hljs-function\"><span class=\"hljs-keyword\">func<\/span> <span class=\"hljs-params\">(p *animal)<\/span><\/span> updateAttributes(newName <span class=\"hljs-type\">string<\/span>, sound <span class=\"hljs-type\">string<\/span>) {\r\n(*p).name = newName\r\n(*p).sound = sound\r\n}<\/pre>\n<p id=\"2b1b\" class=\"pw-post-body-paragraph acz ada abt rc b adb adc vs add ade adf vv adg adh adi adj adk adl adm adn ado adp adq adr ads adt oe bx\" data-selectable-paragraph=\"\"><code class=\"em aez afa afb aei b\">p<\/code>\u00a0is the pointer that function receives when invoked.<\/p>\n<p id=\"013a\" class=\"pw-post-body-paragraph acz ada abt rc b adb adc vs add ade adf vv adg adh adi adj adk adl adm adn ado adp adq adr ads adt oe bx\" data-selectable-paragraph=\"\"><code class=\"em aez afa afb aei b\">*animal<\/code>\u00a0is not a pointer but a mere description of what this function expects when invoked.<\/p>\n<p id=\"30ba\" class=\"pw-post-body-paragraph acz ada abt rc b adb adc vs add ade adf vv adg adh adi adj adk adl adm adn ado adp adq adr ads adt oe bx\" data-selectable-paragraph=\"\">The value in memory that pointer\u00a0<code class=\"em aez afa afb aei b\">p<\/code>\u00a0references to, can be accessed using the\u00a0<code class=\"em aez afa afb aei b\"><strong class=\"rc mw\">*<\/strong><\/code>\u00a0operator.<\/p>\n<p id=\"d29b\" class=\"pw-post-body-paragraph acz ada abt rc b adb adc vs add ade adf vv adg adh adi adj adk adl adm adn ado adp adq adr ads adt oe bx\" data-selectable-paragraph=\"\">Using brackets,\u00a0<code class=\"em aez afa afb aei b\">(*p)<\/code>, will give you the access to the\u00a0<code class=\"em aez afa afb aei b\">struct<\/code>\u00a0attributes.<\/p>\n<p data-selectable-paragraph=\"\"><img decoding=\"async\" src=\"\/blog\/wp-ttn-blog\/uploads\/2024\/01\/1NTrMbKMPL-O0_qxxJh5CUw.png\" \/><\/p>\n<p data-selectable-paragraph=\"\">Let\u2019s run the code again:<\/p>\n<pre><span class=\"hljs-keyword\">go<\/span> run .\r\n\r\n<span class=\"hljs-comment\">\/\/Output<\/span>\r\nOriginal Structure ==&gt; {name:Cat sound:Meeeaaawwwwww}\r\n\r\nUpdated Struct ==&gt; {name:Dog sound:Woof Woof Woof}<\/pre>\n<p data-selectable-paragraph=\"\">Woohooo ?\u2026 we have updated the original struct myAnimal with the power of pointers.<\/p>\n<h2 id=\"d081\" class=\"aga aem abt bu wm agb agc agd qg age agf agg ql qm agh qn qq qr agi qs qv qw agj qx ra agk bx\"><strong>A Gotcha moment\u2026<\/strong><\/h2>\n<p>\u201cabracadabra\u201d, let the code appear\u2026<\/p>\n<pre><span class=\"hljs-function\"><span class=\"hljs-keyword\">func<\/span> <span class=\"hljs-title\">main<\/span><span class=\"hljs-params\">()<\/span><\/span> {\r\nmyAnimal := animal{\r\nname: <span class=\"hljs-string\">\"Cat\"<\/span>,\r\nsound: <span class=\"hljs-string\">\"Meeeaaawwwwww\"<\/span>,\r\n}\r\nmyAnimal.<span class=\"hljs-built_in\">print<\/span>(<span class=\"hljs-string\">\"Original Structure\"<\/span>)\r\n\r\n<span class=\"hljs-comment\">\/\/Let's comment the 2 lines below<\/span>\r\n\r\n<span class=\"hljs-comment\">\/\/myAnimalPointer := &amp;myAnimal<\/span>\r\n<span class=\"hljs-comment\">\/\/myAnimalPointer.updateAttributes(\"Dog\", \"Woof Woof Woof\")<\/span>\r\n\r\n<span class=\"hljs-comment\">\/\/Let's use our same old myAnimal struct without creating a pointer <\/span>\r\nmyAnimal.updateAttributes(<span class=\"hljs-string\">\"Dog\"<\/span>, <span class=\"hljs-string\">\"Woof Woof Woof\"<\/span>)\r\n\r\nmyAnimal.<span class=\"hljs-built_in\">print<\/span>(<span class=\"hljs-string\">\"Updated Struct\"<\/span>)\r\n}\r\n\r\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">func<\/span> <span class=\"hljs-params\">(p *animal)<\/span><\/span> updateAttributes(newName <span class=\"hljs-type\">string<\/span>, sound <span class=\"hljs-type\">string<\/span>) {\r\n(*p).name = newName\r\n(*p).sound = sound\r\n}<\/pre>\n<p>Go automatically takes care of pointer creation in the background so that you don\u2019t have to. And that\u2019s how, you will get the same result:<\/p>\n<pre><span class=\"hljs-keyword\">go<\/span> run .\r\n\r\nOriginal Structure ==&gt; {name:Cat sound:Meeeaaawwwwww}\r\n\r\nUpdated Struct ==&gt; {name:Dog sound:Woof Woof Woof}\r\n\r\n<\/pre>\n<h2 id=\"6611\" class=\"aga aem abt bu wm agb agc agd qg age agf agg ql qm agh qn qq qr agi qs qv qw agj qx ra agk bx\"><strong>The new Keyword<\/strong><\/h2>\n<p>Lets create a pointer using a\u00a0<code class=\"em aez afa afb aei b\">new<\/code>\u00a0keyword:<\/p>\n<pre><span class=\"hljs-keyword\">package<\/span> main\r\n\r\n<span class=\"hljs-keyword\">import<\/span> <span class=\"hljs-string\">\"fmt\"<\/span>\r\n\r\n<span class=\"hljs-keyword\">type<\/span> animal <span class=\"hljs-keyword\">struct<\/span> {\r\nname <span class=\"hljs-type\">string<\/span>\r\nsound <span class=\"hljs-type\">string<\/span>\r\n}\r\n\r\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">func<\/span> <span class=\"hljs-params\">(p *animal)<\/span><\/span> updateAttributes(newName <span class=\"hljs-type\">string<\/span>, sound <span class=\"hljs-type\">string<\/span>) {\r\n(*p).name = newName\r\n(*p).sound = sound\r\n}\r\n\r\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">func<\/span> <span class=\"hljs-title\">main<\/span><span class=\"hljs-params\">()<\/span><\/span> {\r\n<span class=\"hljs-comment\">\/\/ LOOK OVER HERE!!!<\/span>\r\n\r\nmyAnimal := <span class=\"hljs-built_in\">new<\/span>(animal)\r\nmyAnimal.updateAttributes(<span class=\"hljs-string\">\"Dog\"<\/span>, <span class=\"hljs-string\">\"Woof Woof Woof\"<\/span>)\r\nfmt.Printf(<span class=\"hljs-string\">\"%+v\"<\/span>, *myAnimal)\r\n\r\n}\r\n\r\n\r\n<span class=\"hljs-comment\">\/\/Output:<\/span>\r\n{name:Dog sound:Woof Woof Woof}%<\/pre>\n<blockquote>\n<p id=\"d1ae\" class=\"acz ada afw rc b adb adc vs add ade adf vv adg afx adi adj adk afy adm adn ado afz adq adr ads adt oe bx\" data-selectable-paragraph=\"\"><em><strong class=\"rc mw\">Official Definition:<\/strong><\/em><\/p>\n<p id=\"9ab2\" class=\"acz ada afw rc b adb adc vs add ade adf vv adg afx adi adj adk afy adm adn ado afz adq adr ads adt oe bx\" data-selectable-paragraph=\"\"><em>The\u00a0<code class=\"em aez afa afb aei b\">new<\/code>\u00a0takes type as an argument, allocates enough memory to fit a value of that type and returns a pointer to it.<\/em><\/p>\n<\/blockquote>\n<p id=\"b288\" class=\"pw-post-body-paragraph acz ada abt rc b adb adc vs add ade adf vv adg adh adi adj adk adl adm adn ado adp adq adr ads adt oe bx\" data-selectable-paragraph=\"\">I hope, I was able to make this concept a little easier to grasp for all my lovely readers and followers like yourself. If you feel, something can be improved, please drop a comment and I will look into it.<\/p>\n<p id=\"6d1e\" class=\"pw-post-body-paragraph acz ada abt rc b adb adc vs add ade adf vv adg adh adi adj adk adl adm adn ado adp adq adr ads adt oe bx\" data-selectable-paragraph=\"\">Have a lovely day!<\/p>\n<p>. . .<\/p>\n<p id=\"a4e0\" class=\"aga aem abt bu wm agb agw agd qg age agx agg ql qm agy qn qq qr agz qs qv qw aha qx ra agk bx\"><strong>Note of thanks \u2764\ufe0f<\/strong><\/p>\n<p><img decoding=\"async\" src=\"\/blog\/wp-ttn-blog\/uploads\/2024\/01\/0BUBsuzjO99j2qoOs.jpg\" \/><\/p>\n<p>Thank you for stopping by. Hope, you find this article useful. Please <a class=\"ax ahc\" href=\"https:\/\/medium.com\/@shiva.chaturvedi91\" rel=\"noopener\"><strong class=\"rc mw\"><em class=\"afw\">follow me<\/em><\/strong><\/a>\u00a0on medium and help me reach 1k followers ??. That will truly encourage me to put out more content.<\/p>\n<blockquote><p><em>P.S.: If you feel something can be improved or lacks proper explanation, drop me a note in the comment box or mail me at\u00a0<a class=\"ax ahc\" href=\"mailto:shiva.chaturvedi91@gmail.com\" target=\"_blank\" rel=\"noopener ugc nofollow\">shiva.chaturvedi91@gmail.com<\/a>. After all, you can teach me a thing or two as well.<\/em><\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>A pointer, as name suggests, is a variable that points to a location in the memory of your system where a value is stored rather than a value itself. Basically, it is an address to the value stored in memory. The definition is simple but this concept can be a little tricky to wrap your [&hellip;]<\/p>\n","protected":false},"author":1535,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":5},"categories":[4112,1994,1],"tags":[5084,1787,1471,1470,1472,5085,2591],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/56478"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1535"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=56478"}],"version-history":[{"count":3,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/56478\/revisions"}],"predecessor-version":[{"id":59767,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/56478\/revisions\/59767"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=56478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=56478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=56478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}