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 8976211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:04:47+00:00 2026-06-15T19:04:47+00:00

I want my result in this format data: [{label:present,value:35}, {label:absent,value:50}, {label:leave,value:45}, {label:performance,value:67}] I did

  • 0

I want my result in this format

data: [{"label":"present","value":35},
{"label":"absent","value":50},
{"label":"leave","value":45},
{"label":"performance","value":67}]

I did try this code

data: <%= @orders.map { |d| {label: d.shipping, value: d.price}}.to_json.html_safe -%>

which gives result

data: [{"label":"present","value":"35"},
{"label":"absent","value":"50"},
{"label":"leave","value":"45"},
{"label":"performance","value":"67"}]

here problem is in the first label present i obtain value “35” in this format but i need value 35 only without “”. How could i get this?
my data in @orders is

    [#<Order id: 8, price: "35", purchased_at: "2012-01"
, shipping: "present", created_at: "2012-12-13 08:17:39",
 updated_at: "2012-12-13 08:50:13">, #<Order id: 9, price
: "50", purchased_at: "2012-02", shipping: "absent", created_at
: "2012-12-13 08:31:24", updated_at: "2012-12-13 08:50:55">,
 #<Order id: 12, price: "45", purchased_at: "2012-03", shipping: 
"leave", created_at: "2012-12-13 08:48:37", updated_at: "2012-12-13 08:51:07">
, #<Order id: 13, price: "67", purchased_at: "2012-04", shipping:
 "performance", created_at: "2012-12-13 08:48:47", updated_at: "2012-12-13 08:51:18">]
  • 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-15T19:04:48+00:00Added an answer on June 15, 2026 at 7:04 pm
    data: <%= @orders.map { |d| {label: d.shipping, value: d.price.to_i}}.to_json.html_safe -%>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display result of this javascript in a label control on my
First Table is the View and Second is the result I want This below
I want to execute a query like this var result = from entry in
I want to get the result for the 3 most recent months. and this
Normally when I want to query large result set using Mysql I write this
I have trouble doing this... You may want to get the same result as
I'm using MVC 2. I want to format the data that I display in
I use ExtJS4 to request data in format id-label ('id'-'rdfs:label' in my case). I
The Data in the column is stored in this Format. I am storing Data
I want to see if the results of this call: NSDictionary *results = [jsonString

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.