Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8878443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:42:46+00:00 2026-06-14T19:42:46+00:00

I am trying to retrieve the raw JSON used to construct a template and

  • 0

I am trying to retrieve the raw JSON used to construct a template and have it populate in a textarea element.

The structure of the JSON is an array of JSON objects containing three properties which fills out my template fine. What I can’t figure out is how to take that raw JSON element on each iteration and display it within a textarea.

My description of the issue may be a bit obtuse so hopefully the JSFiddle example describes this better.

Javascript

function MyViewModel() {
    this.model = [{
        "Key": "c1243328-4796-46c0-bb32-017d5a1ebdd4",
        "UserId": "02ad61b1-d416-46d4-98ac-d5f6c2b7d104",
        "Name": "\"old.txt\""},
    {
        "Key": "265c23ea-2d2a-459e-9f51-32837e058d01",
        "UserId": "02ad61b1-d416-46d4-98ac-d5f6c2b7d104",
        "Name": "\"sample.dwg\""}];
};

ko.applyBindings(new MyViewModel());

HTML Template

<div data-bind="template: { name: 'template', foreach: model}"></div>

<script type="text/html" id="template">
    <p>
        <span data-bind="text: Key"></span>
        <span data-bind="text: UserId"></span>
        <span data-bind="text: Name"></span>
    </p>
    <p><textarea data-bind="text: ???"/></p>
</script>​

I would like to see the actual JSON element in the textarea and I am not sure what is required to accomplish this.

The above running in jsFiddle

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:42:47+00:00Added an answer on June 14, 2026 at 7:42 pm

    You can use the $data contextual binding property which represents the current viewmodel and the ko.toJSON helper method to output it as a string:

    <textarea data-bind="text: ko.toJSON($data)"/>
    

    See in action in this fiddle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to retrieve and use the raw data from RSS feeds. For
Hi I am trying to retrieve values from database. I have a row which
Trying to make a call and retrieve a very simple, one line, JSON file.
I'm trying to retrieve data from http://api.freebase.com/api/trans/raw/m/0h47 As you can see in text there
I have a large number of files containing data I am trying to process
I am trying retrieve objects with the following model Tools: last_calibration_date: Date period:Integer .
im trying to retrieve some data using a reader in vb.net. I dont have
I am trying opening a audio file (.wav) and retrieve the raw data. I
I am trying retrieve user name from the code through graph api, the below
I´m trying to retrieve the id of the object I've just introduced into the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.