JSON Generator's date formatting convention

One method I use to create a JSON object is through JSON-GENERATOR

I prefer the date to be formatted like this: 2017-12-31

[
  '{{repeat(5, 7)}}',
  {
    equityPriceList: [
      {
        date:'{{date(new Date(1970, 0, 1), new Date(),[DD-MM-YYYY])}}',
        identifiant: "4AAM26636",
        lastDayTrading: "50%",
        marketCapitalization: "13,44",
        objectType: "BUSINESS_GROUP",
        priceClosing: "100",
        twelveMHigh: "50",
        twelveMLow: "30"
      }
    ],
    ordering: "1W"
  }
]

However, I'm currently encountering an error that says:

"date": "<ReferenceError: DD is not defined>"

I have attempted using datef('YYYY-MM-DD'); and other variations as well.

Answer №1

The final argument must be a String, with the day represented in lowercase letters.

Here is an example format:

[
  '{{repeat(5, 7)}}',
  {
    equityPriceList: [
      {
        date:'{{date(new Date(1970, 0, 1), new Date(),"dd-MM-YYYY")}}',
        identifiant: "4AAM26636",
        lastDayTrading: "50%",
        marketCapitalization: "13,44",
        objectType: "BUSINESS_GROUP",
        priceClosing: "100",
        twelveMHigh: "50",
        twelveMLow: "30"
      }
    ],
    ordering: "1W"
  }
]

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

When using UTF-8 encoding, MOXy JAXB mistakenly marshals Unicode (u+2019) as invalid control characters

I have come across a frustrating error while attempting to convert a class to JSON using Eclipse Moxy. In one of my domain classes, I have an attribute with the value: "the City’s original city site", which includes the code point u+2019 (’). However ...

Updating the Navigation Bar and Theme in CRM Dynamics 2013 to Reflect Your Organization's Branding

In my CRM Dynamics 2013 setup, I am faced with a unique challenge. I need to customize the Organization navigation bar based on which organization is currently loaded. Specifically, I have two organizations - QA and PROD. When a user switches to the QA org ...

"Notification: The marker element has been eliminated" encountered while attempting to restore text ranges using Rangy within a Vue component

I have a rather intricate Vue component that includes a contenteditable div. My goal is to highlight words within this div using the Rangy library and add extra markup while retaining this markup even after editing the text. Initially, I planned on asking ...

How can I filter rows in HTML using Vue.js based on string options?

When selecting different options, I want to dynamically add new rows. For instance, if "kfc" is selected, a specific row should be added. If "cemrt" is chosen, another row needs to be included. <div class="card-content" v-for="(bok, index) in rules" :k ...

IE is failing to display the textarea, but it is successfully getting submitted

I've written a function in jQuery and JavaScript that generates a form element: createEmail: function(title){ var $emailForm = $('<form>',{action: 'sendEmail.php', id: 'emailForm'}); var $table = $( ...

Converting XML data (in SOAP format) to a JSON object using JavaScript

Can AJAX be used to send cross-site requests with a SOAP request and receive an XML response? Additionally, is there a framework similar to Mustache that can easily convert the XML response to JSON format? ...

What are alternative methods for reading JSON files in PHP that do not involve file_get_contents()?

Recently, I developed a basic PHP script that fetches data from a local JSON file and uses it to respond to various queries directed at the page. In my implementation, I adopted the usage of file_get_contents() for reading the file. However, as the number ...

Ensuring payload integrity using microrouter: A step-by-step guide

I have utilized this code to develop a microservice const { json, send } = require('micro') const { router, post } = require('microrouter') const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY) console.log(process.e ...

What steps should I take to activate JavaScript type checking in Vue files within Visual Studio Code?

After much exploration, I have successfully configured Visual Studio Code to perform type checking for JavaScript within JS files. This feature highlights any bad code and provides explanations for why it is considered as such here. However, this function ...

Real-time preview of a text field in JavaScript

I'm attempting to create a similar piece of code like the one at the bottom of this page for leaving comments. I have the basic code, but the result doesn't display new lines (or HTML, although that's not essential). I have the function belo ...

Creating a simple form page using Express JS

I am a beginner in the world of Node Js and Express Js, currently diving into learning from a book titled "Jump Start NodeJs" by Sitepoint. The author has provided a simple Login Form page as an example in the book. However, when trying to implement the co ...

Struggling to make changes to a JSON object within a PHP script

Hello, we are in the process of developing a game for a school project and are facing challenges in altering JSON code using PHP. Below is the PHP script we have created to modify the value of an object based on its key: $json_object = file_get_conte ...

`How to prevent Query parameters from being lost upon reloading in Nextjs Router while maintaining a clean URL structure?`

My challenge lies in sending data via router.push to a page with dynamic room id (src/pages/editor/[roomid].tsx) in Next.js. I want the URL to stay clean so users can easily edit their username in the URL if needed. When initially loaded, router.query suc ...

Is it possible for me to design a unique path without relying on redux?

I am working on a Loginscreen.js component import React, { Component } from 'react'; import Login from './Login'; class Loginscreen extends Component { constructor(props){ super(props); this.state={ username:'&apo ...

Error: guild is not defined | discord.js

Having trouble with a ReferenceError that says guild is not defined? I recently encountered a similar issue with members but managed to fix it by adding a constant. As someone new to javascript and node.js, I could use some assistance. I've even tried ...

Ways to conceal and reveal image and text elements based on array loop output

I am currently working on setting up a questionnaire. The questions and answer options are being pulled from a database using an API. Some of the options include images, with the image link stored in the database. I am trying to find a solution where text ...

Invoke a function that generates an array within a v-for loop and iterate through the elements in a Vue.js component

Seeking guidance on the optimal approach for this task. I need to invoke a method within a v-for loop that lazily loads data from a related model. Can anyone advise on the best practice for achieving this? <div v-for="speaker in allSpeaker" :k ...

Unable to disable background color for droppable element

For my project, I am working with two div boxes. My goal is to make it so that when I drag and drop box002 into another div box001, the background color of box001 should change to none. I have attempted to achieve this functionality using jQuery without s ...

Incorporate an external script into your Vue.js application

Seeking to integrate a simple JavaScript script with an external link to the library into my Vue.js application, I have encountered the following: <script type="text/javascript" src="https://my_site/index.js"></script> <link rel="styleshee ...

Guarding Against JSON Injection in C#

I've encountered the code below and during a Fortify scan, we discovered a security vulnerability. This code is susceptible to JSON Injection. How can we securely validate a JSON string? public ActionResult CreateUser(string createUserModel) { Us ...