wp_remote_get()
returns an array containing the response headers and the response body. When you json_encode()
the response, which you appear to have done, then the body is going to be escaped so that it doesn’t break the JSON it thinks you’re trying to create. You’re adding the slashes when you do this.
To get the body of the response you need to then use wp_remote_retrieve_body()
. Then to turn the JSON into an array, you need to use json_decode()
:
$request = wp_remote_get( $url );
$response = wp_remote_retrieve_body( $request );
var_dump( json_decode( $response ) );
Related Posts:
- How to loop through JSON data in wordpress WP REST API
- WP API V2 returning Invalid User ID
- wp_remote_get returns an error for valid URL
- Passing JSON data from WP Query into AJAX causing NULL errors
- Export all post from database to JSON only when the database gets updated
- Create a new user using WP REST API and declare meta object
- How Do I Add User Custom Field to REST API Response?
- API JSON Data in WordPress
- fetch_feed: retrieve entries in the appearing order, not chronologically
- Gutenberg custom block using only register_block_type() and HTML
- How can I export post data in xml format?
- Use wp_remote_get to get JSON instagram feed from public profile
- how to decode % in app [closed]
- Upload a json file in php [closed]
- Why does running get_the_excerpt() when generating JSON file take 28 seconds vs. 599 milliseconds without it?
- How to send user data in json format to another server when user register on wordpress site in PHP
- Create dynamic pages from external JSON data without storing in Database?
- Parsing php string in jquery [closed]
- Vagrantpress + composer
- woocommerce registration form with klaviyo(don’t work with current user)
- Creating a Multi-Level Associative Object Using AJAX
- Fetch post block/field data as JSON with WordPress API
- wp_enqueue_script seperately for each shortcode
- database sent to a JSON file
- Input data from email form not going to JSON file
- PHP > Scheduled Tasks > Sending daily email with dynamic API variables
- Fetching instagram api not working on wordpress
- JSON REST API WordPress only showing first 10 categories
- entire JS folder not loading in a WP theme
- Retrieve Json data and create multiple pages with it
- How to clone all WordPress Rest API end points
- PHP error with a shortcode: “no suitable wrapper” for file_get_contents
- calling admin-ajax.php from admin-ajax.php
- Sending simple variable on single page to WP JSON
- Can’t pass var from php wp_ajax into ajax script : result undefined or null
- Issue with json decode in WordPress – value is not returning consistently
- How does one make a URL return dynamic JSON with custom Content Type?
- How can i send id of the currently posted form data through json response in custom wordpress plugin?
- Need help to create WordPress page that decodes a text file and publishes it in JSON format
- wp_send_json erase last value
- Complex PHP for json_encode > how to handle/output right?
- Can’t get_users info by using json_encode
- AJAX Filter WHILE Loop not working WordPress
- I want to use wordpress database in android app using json encode?
- Result from wp_send_json adds line feed
- Setting pages for posts
- Search in particular category in wordpress
- WordPress format json in postmeta table
- How to post data to a word press site in case of a mobile app
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- I am unable to fetch json data from wp_db
- JSON Object Value Show Undefine
- Force array to be a string [closed]
- get_body_params() is always empty in POST request
- How to enqueue structured data as file – jsonld file seems not to work
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- REST API custom endpoints for metaboxes
- WordPress Register Block with metadata
- How to add a .php file to WordPress
- When to use Exceptions vs Error Objects vs just plain false/null
- Woocommerce get selected shipping zone id for the current user
- Include files in functions.php
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- Add to previous posts under post
- How to show order data by multiple ID?
- how to create and show sessions in word press?
- How to trash multiple post/product programmatically
- Loading jQuery in the footer after removing jQuery migrate?
- Unit Test in WordPress
- “before delete post” action fire when the post is updated?
- WordPress excerpt not working
- Custom Text in WooCommerce Order Processing Email Based on Products
- Best practice for migration friendly images in posts/pages?
- mysql query from wordpress page using custom table
- How can I randomize a Nextgen Gallery Slideshow [closed]
- wp search-replace on database returns PHP fatal error: Array and string offset access syntax with curly braces is no longer supported
- Best way to add more options to Gutenberg “More Rich” text controls drop down
- Connect WordPress with SharePoint [closed]
- Unique icons next to each WordPress menu item
- How to edit php files in Child Theme?
- $Wpdb post meta query is not working with mutliple meta keys and values? [closed]
- Display an image if odd number of posts in grid
- How to use wordpress function wp_enqueue_script() in php?
- Create a package of products as one Item in woocommerce?
- Add a custom class to the body tag using custom fields
- how to edit a specific post slug using a php code?
- Display the video of a post_format Video
- Display multi-select box choices in a bullet list [closed]
- Calling code from another plugin to custom profile field
- In a plugin, How to update a json file using ajax
- couldnt show short code atts in category
- “WARNING: Found @$ in the file __ Possible error suppression is being used
- Changing ALT-tag for logo in wordpress
- Custom Plugin Develoment, Form Action
- Resource 404 error on multisite subdirectory install
- Give permission to admin to see user’s page
- List of child pages fetch next results at link click
- How does add_action ‘comment_post’ work?
- reorder a WP_Query, using a dropdown
- using a shortcode in a hyperlink