-2

could someone give me some direction on how to write a piece of JSON text in JavaScript. eg

{
"Header.MainsiteURL": "http://www.ford.es",
"Header.backToMainsiteMobile": "ES-Main site"
}
6
  • 2
    what you tried so far ? Commented Feb 23, 2017 at 11:17
  • 1
    Can you show some effort on your part first? Commented Feb 23, 2017 at 11:18
  • I have tried to caption the quotation marks with \" _____ \" which was not successful. I've also had a brief look at Java.lang.String to write it. But i'm very new to programming so I'm quite unsure Commented Feb 23, 2017 at 11:22
  • First things first, you should at least know, what programming language you're using. "Java.lang.String"? Are you using Java, not JavaScript? Commented Feb 23, 2017 at 11:26
  • That would be a good start. I'm using JavaScript Commented Feb 23, 2017 at 11:45

1 Answer 1

0

You can declare a single Json object using the following syntax.

var person = {
               Name: "NameOfPerson",
               Age: 23
             }

The following is a Json array for storing people's names and age.

var people = [
               {
                 Name: "NameOfPerson",
                 Age: 23
               },{
                 Name: "NameOfAnotherPerson",
                 Age: 12
               }
             ]

What you seem to be missing in your example are the properties of the object.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.