-
Notifications
You must be signed in to change notification settings - Fork 153
Open
Description
I have code which parses JSON; all keyword values are parsed as strings. Later, I map through the maps and overwrite one of the keywords with the date version of its string data. I have it broken out into two functions and it works. I'm wonding if there's a way to just have the parse function do this? In actuality I have two other elements which need to be converted to dates as well.
(ns clojure-json-test.core
(:gen-class)
(:require [clj-time.core :as t]
[clj-time.format :as f]
[clj-time.local :as l]
[cheshire.core :refer :all]
[org.httpkit.client :as client])
(:import [java.net URI]
[javax.net.ssl SNIHostName SSLEngine SSLParameters]))
;; other code snipped
(defn get-posts-body
[]
(:body @(client/get posts-url api-options)))
(defn get-posts
[]
(parse-string (get-posts-body) true))
(defn get-posts-with-dates
[]
(map #(merge % {:last_viewed_at (f/parse (f/formatters :date-time-no-ms) (:last_viewed_at %))}) (get-posts)))Metadata
Metadata
Assignees
Labels
No labels