0

having a bit of an issue. I am using Firebase with my project and it stores all data in a JSON file. When I am creating the object to push to Firebase in my code like this:

customers.child(uniqueId).set({
    first_name: addCustomerDialogFirstName.value.toString(),
    last_name: addCustomerDialogLastName.value.toString(),
    email: addCustomerDialogEmail.value.toString(),
    organization: addCustomerDialogOrganization.value.toString(),
    address: addCustomerDialogAddressOne.value.toString() + ', ' +
             addCustomerDialogAddressTwo.value.toString() + '\\n' +
             addCustomerDialogAddressCity.value.toString() + ', ' +
             addCustomerDialogAddressState.value.toString() + ' - ' +
             addCustomerDialogZip.value.toString(),
    phone: addCustomerDialogPhoneCountryCode.value.toString() +
           addCustomerDialogPhoneAreaCode.value.toString() +
           addCustomerDialogPhoneRest.value.toString()
});

I'm confused how to get this to display properly in a JSON file. When I look at the JSON file on Firebase it just reads (value of address two)\\n(value of address - city) and doesn't see that the \\n isn't part of a string. Any idea how to get this to display properly in my JSON file? I've never really worked with JSON before this so I'm a bit of a noob. Thanks!

2 Answers 2

3

Why are you escaping the new line character? It should just be \n.

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

Comments

0

You got it wrong here, \\n. It's just \n. Check escape sequence characters

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.