Reputation: 3145
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!
Upvotes: 0
Views: 44
Reputation: 3360
You got it wrong here, \\n
. It's just \n
. Check escape sequence characters
Upvotes: 0