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

  • SEARCH
  • Home
  • 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 7617067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:03:10+00:00 2026-05-31T03:03:10+00:00

Possible Duplicate: Selecting a JSON object with a colon in the key I apologize

  • 0

Possible Duplicate:
Selecting a JSON object with a colon in the key

I apologize if this is a duplicate question. I searched, I really did!

What I’m trying to achieve is a simple date re-format into something nicer like “Friday, March 9, 2012”. I would LOVE to use one of the many convenient jQuery plugins to parse the readily available “pubDate” value into something more useful. Unfortunately there are forces preventing me from importing any other scripts, including jQuery UI. The page template mandated by my superiors imports jQuery and that’s it.

My JSON data contains the following snippet:

"items": [
            {
                "title": "blah blah", 
                "link": "http://url.blah.com", 
                "category": "category blah", 
                "pubDate": "Fri, 09 Mar 2012 16:16:05 -0500", 
                "y:published": {
                    "hour": "21", 
                    "timezone": "UTC", 
                    "second": "5", 
                    "month": "3", 
                    "month_name": "March", 
                    "minute": "16", 
                    "utime": "1331327765", 
                    "day": "9", 
                    "day_ordinal_suffix": "th", 
                    "day_of_week": "5", 
                    "day_name": "Friday", 
                    "year": "2012"
                }, 
                "y:id": {
                    "permalink": "true", 
                    "value": null
                }, 
                "y:title": "blah blah", 
                "description": "more blah blah"
            }

If I’m looping over “items” using $.each, how do I retrieve the values for stuff in “y:published”?

Obviously something like

items.y:published.day_name

doesn’t work because of the colon. Alas, I am not the creator of this content (it’s actually the JSON feed from a Yahoo Pipe, which would probably explain the “y:”); I’m simply tasked with manipulating it. From what I’ve read, the “y:blahblah” entries are non-standard JSON (?) and probably not parsed via .getJSON, in which case I’m screwed. (Sub-question: is this assessment correct?)

(And just so I cover all my bases here: changing the Yahoo Pipe output from JSON to RSS/XML eliminates the “y:published” node altogether, so that’s not an option.)

Thanks in advance. I have no pride; I would appreciate even the most forehead-slappingly simple solution, as long as it could be done with straight js or jQuery.

UPDATE: Answered in record time! Thanks to everyone who contributed.

The solution:

var niceDate =
singleItem['y:published'].day_name + ', ' +
singleItem['y:published'].month_name + ' ' +
singleItem['y:published'].day + ', ' +
singleItem['y:published'].year;
  • 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-05-31T03:03:12+00:00Added an answer on May 31, 2026 at 3:03 am

    items is an array, so to get the first item, you use items[0].

    Then to access the properties on that item that have invalid identifier names, you can use bracketed notation, so:

    console.log(items[0]["y:published"].hour); // 21
    

    In JavaScript, you can access object properties in two ways: With dotted notation and a literal (e.g., foo.bar), or with bracketed notation and a string (foo["bar"]). The two are completely interchangeable, but with the string form the property name doesn’t have to conform to the rules for JavaScript identifier literals.

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

Sidebar

Related Questions

Possible Duplicate: selecting items that come after a specific value i asked this allready
Possible Duplicate: Selecting data from two different servers in SQL Server How can I
Possible Duplicate: How do I calculate someone's age in C#? Maybe this could be
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have
Possible Duplicate: What makes a jQuery object show up as an array in Chrome's
Possible Duplicate: select all checkboxes command jquery, javascript I am having trouble selecting all
Possible Duplicate: Selecting a row in Datagridview Programatically? I am developing a new desktop
Possible Duplicate: Is there a CSS parent selector? Hi! I'm trying to select a
Possible Duplicate: Jquery multiple selectors with this Is it possible to use multiple selectors
Possible Duplicate: Change color of selection How does this site manage to make text

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.