# Abstract Types and StructTypes - error reading AbstractTypes into concrete with JSON3

**URL:** <https://discourse.julialang.org/t/abstract-types-and-structtypes-error-reading-abstracttypes-into-concrete-with-json3/60897>\
**Category:** General Usage\
**Tags:** question, package, json3, structtypes\
**Created:** [May 10, 2021, 3:16pm UTC](https://discourse.julialang.org/t/abstract-types-and-structtypes-error-reading-abstracttypes-into-concrete-with-json3/60897 "2021-05-10T15:16:50Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![djholiver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djholiver/32/50470_2.png) [@djholiver](https://discourse.julialang.org/u/djholiver)\
**Post date:** [May 10, 2021, 6:34pm UTC](https://discourse.julialang.org/t/abstract-types-and-structtypes-error-reading-abstracttypes-into-concrete-with-json3/60897/3 "2021-05-10T18:34:07Z")

</div>

Hi - thanks for responding - updated the above - I hadn’t removed the other subtypes from the listing.

As to the usage - it’s supported by [Structypes.jl](https://juliadata.github.io/StructTypes.jl/stable/) and I make use of it to facilitate multiple dispatch of computations (and filters) provided by users to an http endpoint on top of a calculation library.

i.e. Percentiles require percentile arguments but Average / Sum wouldn’t but they are both of type “ICompute”. The above snippet was / is working fine until I introduced “IQuery”, resulting in the error thrown.

Incidentally - I saw your contribution [here](https://discourse.julialang.org/t/how-do-i-make-a-dispatch-table-using-multiple-dispatch-instead-of-dict/60784/21) and this StructTypes + Interface approach would potentially be applicable (I would post it if it worked…), since the OP is essentially making use of properties of a type rather than the type, with a default required for the generic: implying a conversion step on raw data (JSON?) to a type (or not) and an implementation of that method for the converted type to support multiple dispatch.

Like this:

```julia
#support calcs that allow streaming:
#default - fall through
streamingUpdate!(compute:: ICompute, value) = ()

function streamingUpdate!(ave:: Average, value) 
    
    if(ismissing(value)) return end
    ave.runningTotal += value
    ave.runningCount += 1

end

function streamingUpdate!(sum:: Sum, value) 
    
    if(ismissing(value)) return end
    sum.runningTotal += value

end

```

Regards,

---

_[View the full topic](https://discourse.julialang.org/t/abstract-types-and-structtypes-error-reading-abstracttypes-into-concrete-with-json3/60897)._
