How to convert into json string from variable

I have the following statement

  var test = { 'PropertyID': 'CL' };

if gets used to pull data from the server.    

   data: JSON.stringify(test),

 works fine I always get the CL data.  However I need to create that same string but The CL will change, and gotten from a local storage.  This is what I have tried with no success so far.  Thanks in advance for fixing this for me.

 var myProperty = localStorage.getItem("SelectedProperty")

        var test2 = '{'+'PropertyID'+':'+ myProperty +'}'
mgmhicksAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
Why all the quotes. This should do it:

var test2 = { PropertyID: myProperty }

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mgmhicksAuthor Commented:
thanks your right, forgot about stringify
Chris StanyonWebDevCommented:
Nothing to do with stringify - there's just no need for all the quotes when creating an object.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSON

From novice to tech pro — start learning today.