Yes. Use JSON.parse($string);
to convert your string value to JSON format within Javascript.
<script>
var json_data_string = '{"data":["string no 1","string no 2","string no 3"]}'; // or echo the json_data field as <?php echo $json_data; ?>
var json_data = JSON.parse(json_data_string);
// Now access the properties as
$data = json_data.data; // outputs: string no 1,string no 2,string no 3
$string1 = json_data.data[0]; // outputs: string no 1
</script>
Related Posts:
- Validating Custom Meta Box Values & Required Fields
- Using TinyMce with textareas in meta boxes on custom post types
- Unable to get Preview of Uploaded image within a Custom Meta box
- getEntityRecord without knowing the post type
- HTML / Javascript in custom field textarea?
- Store JSON in a custom field
- Why does this Quick Edit checkbox save the value only when unchecked?
- How to save a ToggleControl value in a meta field?
- Inserting Schema Markup (JSON-LD) Manually with Custom Fields or any Better Ways?
- How to update a meta field of type array in Gutenberg
- Add new image block, set default class name and update it using Javascript
- Manipulate javascript code from custom made admin page menu
- jQuery – Automatic event trigger does not **really** check my form
- Populate Javascript code with value from WordPress Custom Field?
- Meta field bulk editing no longer working in WP 6.0 [closed]
- Type character in name and make it invisble
- how to execute custom field for structured data?
- Custom field in external Javascript
- How can I duplicate “Add Custom Field” with just JavaScript?
- Make Custom Fields Public in JSON – API
- How can I copy value from dropdown once I select it to text area as text?
- How to apply Local Business Google Schema dynamically on a Custom Post single template?
- Modal pop-up HTML code works on other sites or HTML viewers but not in the custom HTML block within a wordpress page?
- Javascript Object push() function
- TypeError: res.json is not a function
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- How can I avoid re-inventing the Custom Fields wheel in my Plugin’s Metabox?
- Using wordpress post data as input for google visualisations
- Does wordpress have something like content-type?
- Order Posts by Closest Numeric Values
- How to get and edit custom fields if in Quick Edit
- Order posts by custom field and if custom field is empty return remaining posts
- Create custom field on post draft or publish?
- Adding a prefix to a post title
- copy attachments to another post type and change attachment url
- Cannot edit post meta fields with rest API
- Only display custom field if it there is a value inside
- Add a post meta key and value only if it does not exist on the post
- Custom field values repeating
- Sorting posts by multiple values, combined
- WP_Meta_Query causing long-running MySQL queries
- trim custom field text value and show (…)
- Duplicate posts being displayed when querying Custom Fields
- Json api does not return all metadata
- Use custom field as a variable
- ACF: How to get the full field name (meta_key) by a field key?
- Tweak Meta for Post to work it for Pages also
- Adding an editable field to template?
- Transferring author information from a custom field to a proper author
- How to select posts from multiple categories and metavalues?
- modify wordpress caption shortcode
- UPDATE on SELECT results. A SQL query to swap Author with Meta Box value
- Alter main archive, to show posts with meta as last
- Add microdata from schema.org [closed]
- Displaying multiple URLs as custom field values
- Linking Custom Fields to Database Records
- Stop sending email everytime I updates my post
- Best way to store everyday post views?
- How to use media upload on metabox post page without breaking TinyMCE?
- Branch made by several custom values
- How can I activate custom fields checkbox in pages?
- Insert image into sub-field with update_post_meta
- Show custom field on attachment page?
- How to use conditional statement with custom field
- WP Insert post with post_thumbnail
- Custom meta boxes in RSS feed
- custom comment_form fields not displaying
- WP_Query () using taxonomy, custom post types
- Ordering by ‘Title’ OR ‘Custom Field’
- How can I add/update post meta in a admin menu page?
- pull all posts’ meta key values from current category only
- Is it possible to use get_post_meta() to control HTML?
- Compare ACF date field (if exists) and post date and order DESC
- Add WordPress user custom meta to chartjs vertically stacked chart in Divi theme
- What am I missing in this Code Block?
- Making WP_Query limit results by date before today where date is a meta_query
- Shortcode for Custom Field of Media Attachment (to use with Featured Images)
- Delete a custom field in mysql for all posts with specific category id
- Trying to get custom field data in a simple plugin
- submitting form to admin-panel.php returns 500 error
- Retrive acf fields in publish_post action for wp_mail
- Update custom field on page specific to logged in user
- Create Meta boxes dynamically
- Outputting custom field on home.php not outside of blog list
- How to delete attachments associated with custom field type when post property changes? [closed]
- Get link picker custom field to show only if field exists
- Connecting a wordpress site to an AngularJS APP
- I have a form with a custom button ,i want to add the field data to an database when clicking the custom button
- custom field images do not display until page save
- How to check custom fields from functions.php
- Paying to Access Custom Fields Per Post
- Custom Field select list is truncated
- Query Posts Via WordPress URL
- How to add a prefix to existing custom fields over MYSQL query?
- Semi-Private Comments + page comments -> is it possible?
- Display custom field outside the loop
- Dynamically update Custom Fields to display new dates
- Add fields to edit in custom widget
- WP Query Args – search by meta_key or title
- ACF in radio button cf7