Extract value from cloudant IBM Bluemix NoSQL Database

How to Extract value from Cloudant IBM Bluemix NoSQL Database stored in JSON format?

I tried this code

def readDataFrameFromCloudant(host,user,pw,database):
   cloudantdata=spark.read.format("com.cloudant.spark"). \
      option("cloudant.host",host). \
      option("cloudant.username", user). \
      option("cloudant.password", pw). \
      load(database)

cloudantdata.createOrReplaceTempView("washing")
spark.sql("SELECT * from washing").show()
return cloudantdata

hostname = ""
user = ""
pw = ""
database = "database"
cloudantdata=readDataFrameFromCloudant(hostname, user, pw, database)

It is stored in this format

{
  "_id": "31c24a382f3e4d333421fc89ada5361e",
  "_rev": "1-8ba1be454fed5b48fa493e9fe97bedae",
  "d": {
    "count": 9,
    "hardness": 72,
    "temperature": 85,
    "flowrate": 11,
    "fluidlevel": "acceptable",
    "ts": 1502677759234
  }
}

I want this result

Expected

Expected

Actual Outcome

Actual Outcome

Extract value from cloudant IBM Bluemix NoSQL Database