aboutsummaryrefslogtreecommitdiffstats
path: root/src/Data/ByteString/Char8/Extended.hs
blob: 4d46cd2c20e3fc676fde5410e3f05508daf6fefd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Data.ByteString.Char8.Extended
    ( module Data.ByteString.Char8
    ) where

import Data.Aeson
import Data.ByteString.Char8
import Data.Text.Encoding (encodeUtf8)

instance FromJSON ByteString where
  parseJSON (String t) = pure (encodeUtf8 t)
  parseJSON _ = pure undefined

instance FromJSONKey ByteString where
  fromJSONKey = FromJSONKeyText encodeUtf8