Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Aleksandro Newsgroups: comp.lang.javascript Subject: Re: convert a string into a json object, Date: Sat, 2 Apr 2016 12:03:03 -0300 Organization: A noiseless patient Spider Lines: 16 Message-ID: References: <906e4754-7a87-4f89-9b85-4068ac79f79a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Sat, 2 Apr 2016 14:59:49 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="7363fa7664fe264696fafdff2cecae6a"; logging-data="14086"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19BNzdORC/Xd1yrEMT2rMpkILkI1DIdvns=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 In-Reply-To: Cancel-Lock: sha1:i42KK7pAsCfu+NKwyUCQ9/9tsqs= Xref: csiph.com comp.lang.javascript:30188 On 01/04/16 19:51, Stefan Weiss wrote: > JRough wrote: >> I struggled with it and I got this part but the result is obj: webdev??? >> kind of a weird result but maybe I don't know how to display an object in js. > [...] >> var jsonObj= {}; >> jsonObj= { "name": str[0]}; >> jsonObj= { "city": str[1]}; >> jsonObj = { "job": str[2]}; > > You assign {} to jsonObj, and then you assign three other things to it. This > cannot possibly work. Please read Stefan Ram's and my reply and try to work > our suggestions into your code. To clear mental ambiguities; jsonObj's value is replaced three times.