From user-return-22043-apmail-spark-user-archive=spark.apache.org@spark.apache.org Tue Dec 9 05:23:49 2014 Return-Path: X-Original-To: apmail-spark-user-archive@minotaur.apache.org Delivered-To: apmail-spark-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 02EA2CD76 for ; Tue, 9 Dec 2014 05:23:49 +0000 (UTC) Received: (qmail 85168 invoked by uid 500); 9 Dec 2014 05:23:46 -0000 Delivered-To: apmail-spark-user-archive@spark.apache.org Received: (qmail 85098 invoked by uid 500); 9 Dec 2014 05:23:46 -0000 Mailing-List: contact user-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list user@spark.apache.org Received: (qmail 85083 invoked by uid 99); 9 Dec 2014 05:23:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Dec 2014 05:23:45 +0000 X-ASF-Spam-Status: No, hits=4.4 required=5.0 tests=HK_RANDOM_ENVFROM,HK_RANDOM_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of huaiyin.thu@gmail.com designates 209.85.217.170 as permitted sender) Received: from [209.85.217.170] (HELO mail-lb0-f170.google.com) (209.85.217.170) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Dec 2014 05:23:41 +0000 Received: by mail-lb0-f170.google.com with SMTP id 10so3352846lbg.15 for ; Mon, 08 Dec 2014 21:21:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=lOQMuR1SGTZGgZIxhNNxcE+/16YdJnuA97blruUgzc4=; b=KUtyfbiUX3ueFrNK1TckIhluGsqZeWUiNf2R9Lth43PjyY8yp/lla+JH3qMJ+WrSnC gOfNJUCFQQ8iRHmQBzokuHsYAjfMUAYa14QDisdN9+y7wIlfjhlF+xcrWij/Q6ERo8uv umeF7ylCUFR4yrD20ITzne/25uJY5VCDRk3n9HOM4MyhUrsQIRvF5KU3id3cyJepp8ji tKmwKIBRa1Rr4cIgrn6TXGeF+ttoV4kZ4F2NHZQnMYhlw4cQIZ8xPP3yekyGhZMs1ZBW jXNCbm3cRcOYdHdP5f2lbjTZDoDnYwmEObekgkPUfeigQxUbW83mDzgUd4vPpfcHaGFA VmmQ== X-Received: by 10.152.26.131 with SMTP id l3mr20041969lag.49.1418102465436; Mon, 08 Dec 2014 21:21:05 -0800 (PST) MIME-Version: 1.0 Received: by 10.112.56.37 with HTTP; Mon, 8 Dec 2014 21:20:45 -0800 (PST) In-Reply-To: <1418100774639-20585.post@n3.nabble.com> References: <1418100774639-20585.post@n3.nabble.com> From: Yin Huai Date: Tue, 9 Dec 2014 00:20:45 -0500 Message-ID: Subject: Re: How to convert RDD to JSON? To: YaoPau Cc: user Content-Type: multipart/alternative; boundary=089e0160ba3ab522000509c1b524 X-Virus-Checked: Checked by ClamAV on apache.org --089e0160ba3ab522000509c1b524 Content-Type: text/plain; charset=UTF-8 If you are using spark SQL in 1.2, you can use toJson to convert a SchemaRDD to an RDD[String] that contains one JSON object per string value. Thanks, Yin On Mon, Dec 8, 2014 at 11:52 PM, YaoPau wrote: > Pretty straightforward: Using Scala, I have an RDD that represents a table > with four columns. What is the recommended way to convert the entire RDD > to > one JSON object? > > > > -- > View this message in context: > http://apache-spark-user-list.1001560.n3.nabble.com/How-to-convert-RDD-to-JSON-tp20585.html > Sent from the Apache Spark User List mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@spark.apache.org > For additional commands, e-mail: user-help@spark.apache.org > > --089e0160ba3ab522000509c1b524 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
If you are using spark SQL in 1.2, you can use toJson to c= onvert a SchemaRDD to an RDD[String] that contains one JSON object per stri= ng value.=C2=A0

Thanks,

Yi= n

On Mon, Dec 8, 2014 at 11:52 PM, YaoPau <jonrgregg@gmail.com> wrote:
Pretty straightforward: Usin= g Scala, I have an RDD that represents a table
with four columns.=C2=A0 What is the recommended way to convert the entire = RDD to
one JSON object?



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/How-to-convert-RDD-to= -JSON-tp20585.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


--089e0160ba3ab522000509c1b524--